Strange Upload
Posted: Fri Jul 31, 2009 8:38 am
Just wondering if anybody has seen this before. I have a folder on the server that stores images to be added to a queue of emails that I'm sending out. This works perfectly for me when I physically drag and drop an image (.jpg) into the folder using CS3 FTP but when I use a simple file upload script then the attachment doesn't get sent.
I can clearly see that the file has been uploaded to the folder using the PHP script as I can see it in the folder and I'm very puzzled as to why the FTP one is recognized but the File Upload one isn't. I can't see any difference and have used the exact same file for FTP and the upload script and it makes no difference. It's like the Upload PHP file is something
different by the time it's uploaded yet if I type a path to this folder I can browse all the images perfectly.
Anyone seen this before?
This is the PHP upload script that I use regularly and it's never given a
problem.
I can clearly see that the file has been uploaded to the folder using the PHP script as I can see it in the folder and I'm very puzzled as to why the FTP one is recognized but the File Upload one isn't. I can't see any difference and have used the exact same file for FTP and the upload script and it makes no difference. It's like the Upload PHP file is something
different by the time it's uploaded yet if I type a path to this folder I can browse all the images perfectly.
Anyone seen this before?
This is the PHP upload script that I use regularly and it's never given a
problem.
Code: Select all
if ($_FILES['fupload']['type'] == "image/jpeg") {
$source = $_FILES['fupload']['tmp_name'];
$target = "folder_1/folder_2/" .$_FILES['fupload']['name'];
/* strip htlm tags white and make lowercase. */
$clean = strip_tags(trim(strtolower($target)));
//strip any spaces
$clean= str_replace(' ' , '_' , $clean);
move_uploaded_file( $source, $clean ); // or die ("couldn't copy");
echo '<br><strong> File'. $clean . ' ' . 'was successfully Uploaded.</strong>';
}