Forum Moderators: coopster

Message Too Old, No Replies

uploading file problem

         

flashman

12:22 pm on Aug 15, 2003 (gmt 0)

10+ Year Member



it is subject.

$file_size=$HTTP_POST_FILES['image']['size'];
$file_name=$HTTP_POST_FILES['image']['tmp_name'];
$file_clientname=$HTTP_POST_FILES['image']['name'];
$file_newplace='cimages'."\\".$file_clientname;
i'm just created simple upload image checking script:
if ($file_name!='')
if (is_uploaded_file($file_name))
{
if ($file_size>$picture_maxsize)
{
$error_event.='File cannot be uploaded because its length more than permissible max size';
}
else
{
if ($error_event=='')
{
copy($file_name,$file_newplace);
// move_uploaded_file($file_name,$file_newplace);
}
}
}
else
{
$error_event.='Sorry, but file is not loaded. Please check file path';
}

On my localhost all ok, but on online host it is generated this error:

Warning: Unable to create 'images\T-clubscene.gif': Permission denied in /home/virtual/site11/fst/var/www/html/calendar/admin.php on line 528

Warning: Unable to move '/tmp/phpA7XMKk' to 'images\T-clubscene.gif' in /home/virtual/site11/fst/var/www/html/calendar/admin.php on line 528

What the problem is?

Kaklz

1:11 pm on Aug 15, 2003 (gmt 0)

10+ Year Member



your local host is windows, and online host - linux .. so you should be really careful about the filenames. no backslashes are used in linux filenames, besides that you should check, whether you have write access in that directory you're trying to write.

andreasfriedrich

1:17 pm on Aug 15, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Make sure that the user the web server is running as has appropriate writing permissions in the directory that you want to move your file to.

You can use either PHP [php.net]'s chmod [php.net] function or your FTP program to change the permissions.

Andreas

waitman

4:09 am on Aug 16, 2003 (gmt 0)

10+ Year Member



also, another note.

if your isp is using a cacheing mechanism such as the squid cache, they can limit the size of the post data.

many isp's use transparent caches that their users have no idear about.

older versions of squid default to 1mb. after i pointed this issue out to the squid maintainer he made the default unlimited, however it is still configurable in the config file.

i have run into this problem in the past, thought i would share it here.

take care,