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.

$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

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/

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.