Uploading pictures problem…

Get help with any scripts or php pages.

Uploading pictures problem…

Postby yanbi » Fri May 15, 2009 3:46 am

Uploading pictures problem…

Hi there I have the following problem…
I use the following php routine in order to upload photos in a site…


// name of the fieldname used for the file in the HTML form
$fieldname = 'file';
// make a note of the current working directory, relative to root.
$directory_self = str_replace(basename($_SERVER['PHP_SELF']), '', $_SERVER['PHP_SELF']);
// make a note of the directory that will receive the uploaded files
$uploadsDirectory = $_SERVER['DOCUMENT_ROOT'] . $directory_self . 'dbimages/';
// make a filename for the uploaded file
$uploadFilename = $uploadsDirectory.'-'.$_FILES[$fieldname]['name'];
// move the file to its final and allocate it with the new filename
@move_uploaded_file($_FILES[$fieldname]['tmp_name'], $uploadFilename) or error('receiving directory insufficient permission', $uploadForm');


My problem is that the last command returns error in DWHS server, but in my home with apache2 and php5 works without any problem…

I also tried out the following ftp procedure…


$c = ftp_connect('ftp.domain.com’) or die("Can not connect");
//(where domain.com is replaced by the actual domain name)
ftp_login($c, $username, $password) or die("Can not login");
ftp_put($c, $uploadFilename, $_FILES[$fieldname]['tmp_name'], FTP_BINARY )
or die("Can not transfer");


But the problem exists also to this procedure in last (ftp_put) command.


Any suggestion please???
yanbi
Welcome to DWHS!
 
Posts: 1
Joined: Thu Apr 30, 2009 7:15 am

Return to PHP and Script Support (new)

Who is online

Users browsing this forum: No registered users and 2 guests

cron