Jump to content

Recommended Posts

I have a script to uploads files works perfect on php4 but when I run the script on php5 the image is never moved from the temp directory

 

here's the code that moves the file once it's been submitted:

<?php
// location where inital upload will be moved to
$target = "assets/images/gallery/" . $_FILES['uploaded']['name'] ;

move_uploaded_file($_FILES["uploaded"]["tmp_name"],$target);
?>

 

Do I need to do something different with php5?

Link to comment
https://forums.phpfreaks.com/topic/144213-image-upload-problem-with-php5/
Share on other sites

the directory is set to 777 no errors on this part i do get errors down the script as I run a resize function for the images and since it can't fine the image it creates an error.

 

But the top code I posted does not generate any errors.

Nothing has changed from php4 to php5 on that count.  Something else must have changed.  If the file is not uploading, you should be getting a warning.  If you are not getting a warning, turn your error reporting on:

 

error_reporting(E_ALL);

 

Try running the top part of your script by itself (comment out the rest or remove it), with error reporting turned on. 

now I get:

 

<?php
Array ( [type] => 8 [message] => Undefined variable: newSnippitOutput [file] => /home3/web/public_html/nuttycoder/index.php [line] => 576 )
?>

 

newSnippitOutput  relates to another file the site is a one page site files are loaded in depending on what section the user is in, not sure if this will affect the upload?

 

If you're not getting an error from move_uploaded_file then it should be uploading....somewhere.  You have your target path/to/file set to:

 

$target = "assets/images/gallery/" . $_FILES['uploaded']['name'] ;

 

you sure you are looking in the right directory? 

If you're not getting an error from move_uploaded_file then it should be uploading....somewhere.  You have your target path/to/file set to:

 

$target = "assets/images/gallery/" . $_FILES['uploaded']['name'] ;

 

you sure you are looking in the right directory? 

 

the exact same site works fine when running on php4 on a different server.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.