Jump to content

Form Not Passing file name


computermax2328

Recommended Posts

Hello again,

 

I have something strange going on. I have a form that you can upload a photo with and on my development computer. It uploads the photo to a folder and stores the path name in a mysql database. I upload this to my Bluehost server and now it stores the photo, but wont pass the $name variable. It will pass the path but forget about the $name variable. I keep getting ../photos/ on my database table when I should be getting ../photos/$name variable.

 

Any tips? I messed around with the php.ini file a little bit. Increased max file upload size and the max post size. 

Link to comment
Share on other sites

<?php
$name = ($_FILES['pic']['name']);
$tmp_name = ($_FILES['pic']['tmp_name']);

if ($name){
    $location = "../photos/$name";
    move_uploaded_file($tmp_name, $location);
}
else {
    echo "please click back and select a file";
}
if (empty($name)) {
    echo "No file submitted. Please click back and select a file.";
}
?>

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.