Jump to content

Need some help with file upload...


phpnoobie9

Recommended Posts

I'm trying to get image2 to have the same name as the first image but be placed in a different directory. I can get the first image to upload and have the name be md5 randomly, but can't get the second image to upload.

 

//Directory paths
$absolutepath = ABSOLUTE_PATH;
$absolutepath2 = ABSOLUTE_PATH2;
echo "Main 150x150 screenshot path: ".$absolutepath."<br /> Secondary 200x200 screenshot path: ".$absolutepath2;

//Start image upload

//Check for an image
$newname = md5(time()*rand(1,99999).$_FILES['image']['name']);
$newname2 = $newname.'.jpg';
if (move_uploaded_file ($_FILES['image']['tmp_name'], ABSOLUTE_PATH."$newname2")) {
echo '<p>Image uploaded</p>';
} else {
echo '<p>Problem uploading image</p>';
}

//Check for image2
if (move_uploaded_file ($_FILES['image']['tmp_name'], ABSOLUTE_PATH2."$newname2")) {
echo '<p>Image2 uploaded</p>';
} else {
echo '<p>Problem uploading image2</p>';
}

Link to comment
Share on other sites

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.