Jump to content

help on PHP. file uploading to web server


runnee

Recommended Posts

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
Share on other sites

$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
Share on other sites

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
Share on other sites

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
Share on other sites

./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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.