views:

99

answers:

1

Alight so, I am working on a small section of a project and I am uploading an image and then copying it to resize afterwards. What is happening is that when I click submit to upload, it fails, but if I hit refresh/resend the info it succeeds...

    $uploadFile = $uploadDir . $imageName;
    $imageName2 = $front[0]."_large\.".$front[1];
    $uploadFile2 = $uploadDir . $imageName2;

        if(move_uploaded_file($imageTemp,$uploadFile))
       {
           if(!copy($uploadFile, $uploadFile2)) die("Can't copy $uploadFile2");
           }

What it outputs when it fails is "Can't copy         " So, for some reason it's not getting the name of the file to be copied to until I hit refresh?

Levi

A: 

Do you mean to escape the dot in $front[0]."_large\.".$front[1]; Were you thinking of a regular expression? if not this might be trying to save into a non existent directory.

Have you tried uploading another file, can you print_r() the $_FILES array, i've been stuck before figuring out why the $_FILES array is empty and there is no multipart form data in my form tag or the image has been corrupt and the upload stream cut by php.

Question Mark