Skip to content

Instantly share code, notes, and snippets.

@rubensayshi
Created November 9, 2012 15:15
Show Gist options
  • Save rubensayshi/4046243 to your computer and use it in GitHub Desktop.
Save rubensayshi/4046243 to your computer and use it in GitHub Desktop.
<?php
var_dump($_FILES);
if(isset($_FILES["uploadedfile"]) && $_FILES["uploadedfile"]["size"] > 0) {
$target_path = 'marketing/';
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "<p>The file ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded</p>";
} else{
echo "<p>There was an error uploading the file, please try again!</p>";
}
var_dump(is_writable($target_path));
}
?>
<form enctype="multipart/form-data" action="" method="POST">
Choose a file to upload: <input name="uploadedfile" type="file" /> <br />
<input type="submit" value="Upload File" />
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment