Forum de discussions NFrance - Support offres dédiées et mutualisées
Vous n'êtes pas identifié.
Hi,
I am an existing discount-hosting customer (domain name www.magdalenausa.org).
I am trying to create an image upload form using the PHP upload script. In order to do so I need the full file path for my web site. I also need to ensure that full read/write permissions on the spgm directory in my site.
Can you please assist me with both of these items?
Also, can you please remind me of the size limit for my site? It used to be on the discount hosting home page but is no longer since the page has changed.
Thanks,
Sara
Hors ligne
Thank you for your reply.
I am very familiar with the PHP code and how to write the page to do the uploads.
What I am asking you for is what do I put in this line of the code:
$uploaddir = 'path to upload folder';
It requires I know the *full path* to my web site, which I don't. Once within the site I know the folder structure, but I don't know the path for it on the server from the root.
Is there a way you can tell me the path?
Thank you!
Hors ligne
You can get your path by looking into the phpinfo() function.
Create a PHP file with the following content:
<?php phpinfo(); ?>
Hors ligne
Thank you.
Now can you help me get the permissions opened up on both the file upload temp directory and on my site so that I can do uploads?
I am encountering an error that lets me know that at least one of those folders is not writable.
The temp upload directory is /tmp-php/
Thanks,
Sara
Hors ligne
You are not allowed to write in /tmp-php/
Create a "tmp-php" dir in your home directory, do a chmod 0777 on your tmp-php directory, now do the same with an "upload" directory (create and chmod).
Now you can use the following funtion to handle your file uploads:
move_uploaded_file ("$file","upload/$file_name");
Hors ligne
That would have been helpful information to know earlier. ![]()
Is there now a support page or area available for discount hosting clients (there never was in the past) that provides information like this or is this forum the best place to do this?
I will try that and get back to you if I have any further issues.
Thanks,
Sara
Hors ligne
The best place is this forum until the FAQ are online at http://www.nfrance.info/ (on the 5th of september)
Hors ligne
Hi,
I have done all you have suggested and it still doesn't work.
The error message I get is:
Array ( [image] => Array ( [name] => wwmiccable.jpg [type] => image/jpeg [tmp_name] => /var/tmp/phppeLlcx [error] => 0 [size] => 6230 ) )
This error message shows me that the PHP upload script is trying to use the /var/tmp directory on the server, even though I have created a /tmp-php folder on my site and chmod the settings to 0777.
When I look in my phpinfo() I see that the upload_tmp_dir is set to ./tmp-php/
What can I do to get my temp directory to be recognized properly?
Thanks,
Sara
Hors ligne
Also...I have tried using the ini_set() command to set the temp directory and I have tried creating a /var/tmp directory on my site. Neither of those have worked.
Your assistance is greatly appreciated.
Sincerely,
Sara
Hors ligne
In face the tmp-php described in tutorial depends from the server ...
According to your error message, try to set right permissions to 777 in the folder you want to upload your files (/images/ for ex.) The file seems to be right uploaded on the server but wrong moved, maybe due to unsufficent permissions on destination folder.
Hors ligne
Thank you for your response.
I have checked permissions on all the folders where the images upload to and they are set to 777. I am still getting the same error.
I have set proper permissions for both the tmp-php folder and the folders where the images get moved to.
You say the tmp-php depends from the server, do you mean a different tmp-php folder than the one in my site directory or the one that is indeed in my site?
If in my site I have set the permissions to 777, if somewhere else, how can I get the permissions to be set properly.
Can you please check the permissions for the tmp-php folder on the server where my site is hosted and ensure that it is set to 777?
I have successfully created a PHP file upload script just like this on many other hosts, yours is the only one where I am running into this problem.
Thank you for your assistance,
Sara
Hors ligne
Ok, I deal a read access to your upload script with administrators ![]()
Apparently all your images directories are set in 777, so it's ok for uploading files ; but the script try to upload with a full path name (/home/dxxx/...), and maybe he don't find the beginning of the way (due to security rights), so try to set a relative path (spgm/gal/) ...
Otherway all seems to be good, i didn't see specific errors ...
Hors ligne
Thank you for your response.
I just tried setting the path to be relative and it still didn't work. I get the same error as before.
Array ( [image] => Array ( [name] => wwmiccable.jpg [type] => image/jpeg [tmp_name] => /var/tmp/phprqsVXj [error] => 0 [size] => 6230 ) ) Error uploading the product image file.
Can you please tell me where the /var/tmp folder is and how I can get the proper permissions set on it? In the error message this is being shown as the temp upload folder...this folder is not on my site, so it must be somewhere else on the server.
I know (and you have verified) that all the permissions are set correctly on my site. I need to confirm that the permissions are set correctly for the temp folder (/var/tmp) before I can confirm that this is not a permissions issue.
If this is what you were telling me you did before, please excuse me because I didn't understand.
I really appreciate your assistance.
Sara
Hors ligne
I made a few test last week, and it appears that on your server (discount-hosting) we must define a directory named for exemple tmp , with 777 rights to upload files correctly.
/var/tmp/ exists but is not used due security configuration (safe mode) to upload functions.
Here a little script I test and which works :
if(strlen($_FILES['userfile']['name']) > 0)
{
$uploaddir = 'tmp/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
echo "<p>\n";
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo 'Upload du fichier '.$_FILES['userfile']['name'].' reussi !
';
} else {
echo 'Upload echoue.';
}
echo "</p>\n";Hors ligne