I have a nightmare using PHP to upload files to my server, however when using this simple HTML form it works:
<html><body> <form enctype="multipart/form-data" action="uploads.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> Choose a file to upload: <input name="uploadedfile" type="file" /><br /> <input type="submit" value="Upload File" /> </form>
Then PHP:
<?php $target_path = "uploads/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } ?>
Is there any possible way to send a file using this method using curl from the command line or shell script? sort of:
curl -f "@/path/to/my/file;type=text/html" http:
This particular line gives me: "curl: (22) Could not connect to :: 1: Permission denied", although there is no password on the site, etc. I assume this is possible, but I get the syntax wrong
source share