problem with move_uploaded_file

2013-05-25  Source: Original Site  Category:PHP  Views:0 

Advertisement

I am using the following code to upload a file into a directory. It is working great but I would like the name of the file...to be the value ListID

I cant seem to do this....

I tried changin this line
$uploadfile = $uploaddir . $_FILES['photofile']['name'];

to

$uploadfile = $uploaddir . $_FILES['photofile']['ListID'];

But it didnt work...how can I do this?

mysql_query("INSERT INTO `listings` (`ListID`,`PropType`) VALUES ('$ListID','PropType')");

$uploaddir = '/httpd/customers/virtual/website/htdocs/admin/uploads/';
$uploadfile = $uploaddir . $_FILES['photofile']['name'];

print "<pre>";
if (move_uploaded_file($_FILES['photofile']['tmp_name'], $uploadfile)) {
print "File is valid, and was successfully uploaded. ";
print "Here's some more debugging info:\n";
print_r($_FILES);
} else {
print "Possible file upload attack! Here's some debugging info:\n";
print_r($_FILES);
}
print "</pre>";

Related articles
  • Problem with move_uploaded_file(), account on server full? 2015-03-20

    I have a strange problem with my image-uploader-resizer-code on my webpage. Suddenly one day I wasn't able to upload pictures anymore. The first thought that hit me was of course that I've run out of space on the server that hosts my site. If I delet

  • problems with move_uploaded_file 2012-04-28

    I have a script which uses move_uploaded_file. It works well with smaller files (i.e. <300K), but I recently tried uploading a file sized at 34mb and it comes up with a 'page not found' error on my server. The page is acually there, and works with

  • problem with move_uploaded_file 2013-05-25

    I am using the following code to upload a file into a directory. It is working great but I would like the name of the file...to be the value ListID I cant seem to do this.... I tried changin this line $uploadfile = $uploaddir . $_FILES['photofile']['

  • PHP move_uploaded_file() - problem with permissions 2012-10-01

    I have written a simple php program to allow the uploading of image files to a website. This works fine on my test server, but I have problems with the live site. Warning: move_uploaded_file(../Speakers/test.jpg) [function.move-uploaded-file]: failed

  • Form problems with IE 2013-03-09

    I am having some problems with IE and Opera browsers not displaying all my form select boxes, for example: Firefox (Working): HTTP/1.1 200 OK Cache-Control: no-cache Pragma: no-cache Content-Type: text/html; charset=utf-8 Content-Encoding: gzip Expir

  • RESOLVED: Problem with a .jpeg extension where .jpg works OK in a PHP/ Mysql gallery 2013-03-15

    I am having a problem with uploading files .jpeg extensions to a PHP/Mysql gallery. The .jpg extension work but not the .jpeg extension. To rectify the problem I tried first to replace the reference to the .jpg extension to .jpeg in my 'functions.php

  • PHP Problem with file upload 2013-10-01

    Hi, I am having a problem with my file upload. I have a folder with my fileform.html and upload_file.php and a folder "upload" where my uploaded file stored. This is the body of my fileform.php: <form action="upload_file.php" method="post"enctype=

  • Problems with Image Upload & Chmod 2013-10-30

    I've been having problems with uploading images and setting the correct permissions. The code will follow shortly. The image uploads ok, i can download the image via ftp and view it so I know that it hasn't been corrupted. I go to check the permissio

  • Problems with updating/deleting files with PHP 2014-01-22

    I have been having problems with files that have been either writen or uploaded through PHP. The first instance is when I upload a file using a form and then using "move_uploaded_file" to move the file to the correct folder. I can upload the file jus

  • it's me again, I have a problem with this "mini-CMS" I am buidling, images dont UPDAT 2014-02-24

    I have a problem with this "mini-CMS" I am buidling as I'm trying to learn this PHP thing... Everything seems to be working OK, EXCEPT when I try to UPDATE the images from a specific record, it only updates one of the images, and it always looks like

  • Problem with a .jpeg extension where .jpg works OK in a PHP/ Mysql gallery 2014-05-09

    I am having a problem with uploading files .jpeg extensions to a PHP/Mysql gallery. The .jpg extension work but not the .jpeg extension. To rectify the problem I tried first to replace the reference to the .jpg extension to .jpeg in my 'functions.php

  • Newbie problem with uploading txt file 2014-05-26

    I got this code from a books CD, but it doesn't seem to work. Can you see any problems with the code? It gives me these errors. Warning: move_uploaded_file(/uploads/message.txt) [function.move-uploaded-file]: failed to open stream: No such file or di

  • problem with in_array - please help 2014-07-18

    I'm having problem with this function. I created this function to upload a file to a specific directory, the function is supposed to take into account only uploading allowed files but for some reason it is not preventing files that are not in the all

  • Problem with PHP upload script 2014-09-25

    I have a problem with a simple PHP upload script on the following page: http://www.pixelrite.co.uk/contact.html The error in http://www.pixelrite.co.uk/upload_file.php is the following: Warning: move_uploaded_file(/home/pixelriteuk/public_html//uploa

  • Problems with mysql INSERT query and an image* upload file 2014-11-11

    I am working on this form, that is meant for only site owners and crew to use, so i didn't run any checks on the input, i trust the discretion of the users. It's a basic application that adds a product into the database, a name, the description, and

  • embedded upload files code ceases tow work. problem with $_FILES? 2015-02-24

    Alright, i'm having some problems with this code... the idea here is an edit profile type page were one can also upload an avatar for use in my forum. Now the problem: I got the upload and error checking code itself working, but when i embed it into

  • Constant problem with standard ubuntu jaunty repos 2012-01-01

    Before upgrading to J I ve found that I have problems with standard repos. After upgrading I ve tried to fix and succeeded. Partly. The problem was my *.dpg keys become invalid,(every resource string contain version of ubuntu name). I ve downloaded k

  • Ubuntu Printer problems with Brother HL-5250DN 2012-01-01

    After succesfully installing the Brother HL-5250DN printer over the network on Ubuntu Feisty Fawn I encountered the following problems. Often the queues won't come through and the printer needs to be reset to be able to print. I gave the printer a fi

  • Oracle Text - Problem with filtering binary documents (.doc, .pdf, etc...) 2012-01-01

    Hi, I have a problem with filtering binary documents (.doc, .pdf, etc...). I use SQL*PLUS for remote access to Oracle 10.2 on Linux and I create table: CREATE TABLE test (id NUMBER PRIMARY KEY, text VARCHAR2(100)); I insert to this table: INSERT into

  • Problem with dimporting ata from MySQL 2012-01-01

    Hello I've created a table in derby with the following command: CREATE TABLE test ( ID INT NOT NULL GENERATED ALWAYS AS IDENTITY, value VARCHAR(255), PRIMARY KEY(ID) ) My problem is: i want to export some data from mysql to derby, but derby has a pro