upload image problem 
Author Message
 upload image problem
Hi,

i am using the following code to upload images, howeverit doesnt seem to
work:

    if (mysql_query($query)){
     $image_id = mysql_insert_id($connection);
     $dir = "user_images/";
     $thumbnail_dir = "thumbnails/";
     $temp = "temp.jpg";
     $newFileName = "$image_id.jpg";
     if (copy ($image, $dir.$image_name)){
      if (copy ($image, $thumbnail_dir.$image_name)){
       rename($dir.$image_name, $dir.$newFileName);
       rename($thumbnail_dir.$image_name, $thumbnail_dir.$newFileName);

the image is uploaded to the 'user_images' directory but not to the
'thumbnails' directory and not renamed. More annoyingly i am not getting any
error messages. I would be very grateful for any advice you can offer

Thanks



Tue, 21 Jun 2005 02:45:06 GMT  
 upload image problem
For your second copy statement I would try:
copy ($dir.$image_name, $thumbnail_dir.$image_name)

It would seem to me the uploaded file is being cleared out of the temp
directory after the first copy.   It's probably not your permissions if
you're not getting any errors, but always good to check anyway.

I would also checkout: http://www.php.net/manual/en/features.file-upload.php


Quote:
> Hi,

> i am using the following code to upload images, howeverit doesnt seem to
> work:

>     if (mysql_query($query)){
>      $image_id = mysql_insert_id($connection);
>      $dir = "user_images/";
>      $thumbnail_dir = "thumbnails/";
>      $temp = "temp.jpg";
>      $newFileName = "$image_id.jpg";
>      if (copy ($image, $dir.$image_name)){
>       if (copy ($image, $thumbnail_dir.$image_name)){
>        rename($dir.$image_name, $dir.$newFileName);
>        rename($thumbnail_dir.$image_name, $thumbnail_dir.$newFileName);

> the image is uploaded to the 'user_images' directory but not to the
> 'thumbnails' directory and not renamed. More annoyingly i am not getting
any
> error messages. I would be very grateful for any advice you can offer

> Thanks



Tue, 21 Jun 2005 03:36:38 GMT  
 upload image problem
thanks for your reply, but that didn't work, any other ideas?


Quote:
> For your second copy statement I would try:
> copy ($dir.$image_name, $thumbnail_dir.$image_name)

> It would seem to me the uploaded file is being cleared out of the temp
> directory after the first copy.   It's probably not your permissions if
> you're not getting any errors, but always good to check anyway.

> I would also checkout:

http://www.php.net/manual/en/features.file-upload.php
Quote:



> > Hi,

> > i am using the following code to upload images, howeverit doesnt seem to
> > work:

> >     if (mysql_query($query)){
> >      $image_id = mysql_insert_id($connection);
> >      $dir = "user_images/";
> >      $thumbnail_dir = "thumbnails/";
> >      $temp = "temp.jpg";
> >      $newFileName = "$image_id.jpg";
> >      if (copy ($image, $dir.$image_name)){
> >       if (copy ($image, $thumbnail_dir.$image_name)){
> >        rename($dir.$image_name, $dir.$newFileName);
> >        rename($thumbnail_dir.$image_name, $thumbnail_dir.$newFileName);

> > the image is uploaded to the 'user_images' directory but not to the
> > 'thumbnails' directory and not renamed. More annoyingly i am not getting
> any
> > error messages. I would be very grateful for any advice you can offer

> > Thanks



Tue, 21 Jun 2005 07:31:56 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Problem uploading image in Mozilla

2. TCL code to extract image information from uploaded image file

3. Uploading a file to the VisualWave Image

4. Howto write an image upload CGI script ?

5. uploaded images are messed up (only way I can describe)

6. image upload - files not viewable via ftp

7. Upload, renaming images

8. Uploading Images and PIL

9. Newbie:Please Help!!! WWW Image Uploading and Python

10. Colormap problems (Image display, Image fromUser)

11. SOFTWARE UPLOAD: ftnchek 2.70 LARGE_MACHINE uploaded

12. import Image vs from PIL import Image vs import PIL.Image

 

 
Powered by phpBB® Forum Software