6 Replies - 542 Views - Last Post: 28 February 2013 - 06:44 AM Rate Topic: -----

#1 jordfc  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 09-November 12

Multiple File Upload Problem

Posted 26 February 2013 - 06:56 PM

Hi there, I am having difficulty trying to allow the use of multiple file upload to multiple directories, when i had just the photo one it worked fine however when i tried to implement the video upload and move it to a different directory to the photo it wouldnt upload/move the file?

this is the two fields used in the form
<li>
              		<label>Photo: </label>
            		<input type="hidden" name="size" value="350000">
            		<input type="file" name="photo">
				</li>
				<li>
              		<label>Video: </label>
            		<input type="hidden" name="videosize" value="350000">
            		<input type="file" name="video">
				</li>




and this is the code used to upload/move the files
$target = "auctions/";
$target = $target . basename( $_FILES['photo']['name']);

$vidtarget = "videos/";
$vidtarget = $vidtarget . basename( $_FILES['video']['name']) ;

//This gets all the other information from the form
$pic=($_FILES['photo']['name']);

$video=($_FILES['video']['name']);


$sellquery = ("INSERT INTO `ip_products` (`user_id`, `p_name`, `p_category`, `p_category_refined`, `p_condition`, `p_end`, `p_start_price`, `p_buyout`, `p_description`, `p_trade`, `p_mainphoto`, `p_video`)
				VALUES ('$user_id', '$p_name', '$p_category', '$p_category_refined', '$p_condition', '$p_end', '$p_start_price', '$p_buyout', '$p_description', '$p_trade', '$pic', '$video')");

 //&& move_uploaded_file($_FILES['video']['tmp_name'], $vidtarget)

echo "<div id=\"fieldsetblock\">";
if (mysql_query($sellquery) && move_uploaded_file($_FILES['photo']['tmp_name'], $target) && move_uploaded_file($_FILES['video']['tmp_name'], $vidtarget))
{
	echo "Your auction was successfully listed!\n";
	echo "<br/>";
	echo "You will be redirected in 5 seconds";
}
else
{
	echo "There was a problem processing your action, please try again\n";
	echo "<br/>";
	echo "You will be redirected in 5 seconds";
}
echo "</div>";






Is This A Good Question/Topic? 0
  • +

Replies To: Multiple File Upload Problem

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6063
  • View blog
  • Posts: 23,515
  • Joined: 23-August 08

Re: Multiple File Upload Problem

Posted 27 February 2013 - 04:38 AM

Most likely problem would be insufficient permissions on the target directory.
Was This Post Helpful? 0
  • +
  • -

#3 jordfc  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 09-November 12

Re: Multiple File Upload Problem

Posted 27 February 2013 - 06:08 AM

To be honest i dont really know what that means but i think it must be an error in the code somewhere because i tried doing it the same way as the photo upload and that worked fine on its own just when i try putting the two together
Was This Post Helpful? 0
  • +
  • -

#4 laytonsdad  Icon User is offline

  • Cheese and Sprinkles
  • member icon

Reputation: 440
  • View blog
  • Posts: 1,867
  • Joined: 30-April 10

Re: Multiple File Upload Problem

Posted 27 February 2013 - 10:31 AM

Check size restrictions on the server.
Was This Post Helpful? 1
  • +
  • -

#5 jordfc  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 09-November 12

Re: Multiple File Upload Problem

Posted 27 February 2013 - 01:39 PM

its just hosted locally though but ill try have a look thanks, can you see any problems in the code at all though by any chance?
Was This Post Helpful? 0
  • +
  • -

#6 andrewsw  Icon User is offline

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3473
  • View blog
  • Posts: 11,788
  • Joined: 12-December 12

Re: Multiple File Upload Problem

Posted 27 February 2013 - 01:48 PM

I can't see an obvious coding error. Besides, if it works for photo then this suggests:

It is a problem with the size of the video; or
The limit(s) set for the size of the video;
The server doesn't like the file-type. Etc.

<input type="hidden" name="videosize" value="350000">

This value is in bytes so you might need to throw in an extra nought.
Was This Post Helpful? 0
  • +
  • -

#7 jordfc  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 09-November 12

Re: Multiple File Upload Problem

Posted 28 February 2013 - 06:44 AM

thanks for the help, i have figured out that it is indeed the file type causing the problem because when i try to upload a mp4 video in the photo field instead of a jpg the query basically remains empty instead of retrieving the values from the form so i presume i need to increase the size limit the server can take?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1