runnee Posted July 20, 2009 Share Posted July 20, 2009 Warning: move_uploaded_file(/imageuploads/f5d41ba87d5f0a354cae52f62aa87bd7.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in E:\IISRoot\RP\74429\FYP\do_add_image.php on line 72 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'D:\xampp\tmp\php54E.tmp' to '/imageuploads/f5d41ba87d5f0a354cae52f62aa87bd7.jpg' in E:\IISRoot\RP\74429\FYP\do_add_image.php on line 72 I kept getting this error. I am upload fine when doing it on my own localhost. But once i upload everything online, it just could not work anymore. Anyone can help me please. Link to comment https://forums.phpfreaks.com/topic/166580-help-on-php-file-uploading-to-web-server/ Share on other sites More sharing options...
Amtran Posted July 20, 2009 Share Posted July 20, 2009 Post some code. Link to comment https://forums.phpfreaks.com/topic/166580-help-on-php-file-uploading-to-web-server/#findComment-878428 Share on other sites More sharing options...
chokies12 Posted July 20, 2009 Share Posted July 20, 2009 post your code there's something wrong with your directory Link to comment https://forums.phpfreaks.com/topic/166580-help-on-php-file-uploading-to-web-server/#findComment-878474 Share on other sites More sharing options...
runnee Posted July 20, 2009 Author Share Posted July 20, 2009 $host = 'myhostname'; $usr = 'myusername'; $pwd = 'mypassword'; $fileName = $_FILES['fileToUpload']['name']; $tmpName = $_FILES['fileToUpload']['tmp_name']; $fileSize = $_FILES['fileToUpload']['size']; $fileType = $_FILES['fileToUpload']['type']; // get the file extension first $ext = substr(strrchr($fileName, "."), 1); // make the random file name $randName = md5(rand() * time()); $randFilename = $randName . '.' . $ext; // and now we have the unique file name for the upload file $filePath = $uploadDir . $randFilename; // file to move: $local_file = $randFilename; $ftp_path = 'videouploads/'; (my main website folder is /FYPSIT/videouploads) // connect to FTP server (port 21) $conn_id = ftp_connect($host, 21) or die ("Cannot connect to host"); // send access parameters ftp_login($conn_id, $usr, $pwd) or die("Cannot login"); // turn on passive mode transfers (some servers need this) // ftp_pasv ($conn_id, true); // perform file upload $upload = ftp_put($conn_id, $ftp_path, $local_file, FTP_ASCII); // check upload status: print (!$upload) ? 'Cannot upload' : 'Upload complete'; print "\n"; if (!function_exists('ftp_chmod')) { function ftp_chmod($ftp_stream, $mode, $filename){ return ftp_site($ftp_stream, sprintf('CHMOD %o %s', $mode, $filename)); } } // close the FTP stream ftp_close($conn_id); **I have solved the 1st one myself. Now its about uploading of videos to the FTP. and embedding the videos after. I need a solution.. my project is due in 1 weeks time. Pls help guys Link to comment https://forums.phpfreaks.com/topic/166580-help-on-php-file-uploading-to-web-server/#findComment-878483 Share on other sites More sharing options...
runnee Posted July 20, 2009 Author Share Posted July 20, 2009 Warning: ftp_put(e19e3d1ab8ffd5936bd889e014614483.wmv) [function.ftp-put]: failed to open stream: No such file or directory in E:\IISRoot\RP\74429\FYPSIT\do_add_video.php on line 83 Cannot upload I am failing at the upload part. Link to comment https://forums.phpfreaks.com/topic/166580-help-on-php-file-uploading-to-web-server/#findComment-878484 Share on other sites More sharing options...
chokies12 Posted July 20, 2009 Share Posted July 20, 2009 $ftp_path = 'videouploads/'; try this $ftp_path = '/videouploads/'; Link to comment https://forums.phpfreaks.com/topic/166580-help-on-php-file-uploading-to-web-server/#findComment-878487 Share on other sites More sharing options...
runnee Posted July 20, 2009 Author Share Posted July 20, 2009 It didnt work Link to comment https://forums.phpfreaks.com/topic/166580-help-on-php-file-uploading-to-web-server/#findComment-878489 Share on other sites More sharing options...
Coreye Posted July 20, 2009 Share Posted July 20, 2009 It didnt work Are you getting the same error or a different one? Link to comment https://forums.phpfreaks.com/topic/166580-help-on-php-file-uploading-to-web-server/#findComment-878491 Share on other sites More sharing options...
chokies12 Posted July 20, 2009 Share Posted July 20, 2009 /FYPSIT/videouploads/ try this one.. Link to comment https://forums.phpfreaks.com/topic/166580-help-on-php-file-uploading-to-web-server/#findComment-878497 Share on other sites More sharing options...
runnee Posted July 20, 2009 Author Share Posted July 20, 2009 Warning: ftp_put(f7c5105856dc6d2005909dba8eafd2e8.wmv) [function.ftp-put]: failed to open stream: No such file or directory in E:\IISRoot\RP\74429\FYPSIT\do_add_video.php on line 83 Cannot upload for /FYPSIT/videouploads Link to comment https://forums.phpfreaks.com/topic/166580-help-on-php-file-uploading-to-web-server/#findComment-878664 Share on other sites More sharing options...
runnee Posted July 21, 2009 Author Share Posted July 21, 2009 bump Link to comment https://forums.phpfreaks.com/topic/166580-help-on-php-file-uploading-to-web-server/#findComment-879214 Share on other sites More sharing options...
Q Posted July 21, 2009 Share Posted July 21, 2009 ./videouploads/ could be your answer, but I'm affraid you need a php command to change directory on your FTP server. That was the solution for me last time I made anything with FTP. ftp_chdir might also be your answer Link to comment https://forums.phpfreaks.com/topic/166580-help-on-php-file-uploading-to-web-server/#findComment-879216 Share on other sites More sharing options...
runnee Posted July 21, 2009 Author Share Posted July 21, 2009 I am sorry to say but Warning: ftp_put(660ef4b2f9dd3781c2e0c1fcf3f693e7.wmv) [function.ftp-put]: failed to open stream: No such file or directory in E:\IISRoot\RP\74429\FYPSIT\do_add_video.php on line 83 Cannot upload Same thing. for ./FYPSIT/videouploads/ and ./videouploads/ Link to comment https://forums.phpfreaks.com/topic/166580-help-on-php-file-uploading-to-web-server/#findComment-879269 Share on other sites More sharing options...
runnee Posted July 21, 2009 Author Share Posted July 21, 2009 Weird. I went to my FTP site and I saw the file existing there. I'll try to download and see if I could play it. Link to comment https://forums.phpfreaks.com/topic/166580-help-on-php-file-uploading-to-web-server/#findComment-879271 Share on other sites More sharing options...
Q Posted July 21, 2009 Share Posted July 21, 2009 Tried ftp_chdir as I mentioned earlier? Link to comment https://forums.phpfreaks.com/topic/166580-help-on-php-file-uploading-to-web-server/#findComment-879272 Share on other sites More sharing options...
runnee Posted July 21, 2009 Author Share Posted July 21, 2009 Ok sorry, I upload fine using $_FILES upload. my code error. Anyway I am using this way is because is it better to have it sent by FTP for files or HTTP? After which I just want to be able to embed my videos. Link to comment https://forums.phpfreaks.com/topic/166580-help-on-php-file-uploading-to-web-server/#findComment-879273 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.