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
https://forums.phpfreaks.com/topic/264131-form-not-passing-file-name/
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.";
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.