Jump to content

Check out our Community Blogs

Julien Duponte

Member Since 13 Apr 2011
Offline Last Active Apr 29 2011 11:38 AM

Topics I've Started

move_uploaded_file(images/) [function.move-uploaded-file]: failed to open stream

26 April 2011 - 01:16 PM

I'm back with more problems.

I'm getting the errors:

Warning: move_uploaded_file(images/) [function.move-uploaded-file]: failed to open stream: Is a directory in /home/billing/vhosts/yakimaimplement.com/used_test/add.php on line 23

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpmb59hD' to 'images/' in /home/billing/vhosts/yakimaimplement.com/used_test/add.php on line 23
Sorry, there was a problem uploading your file. Please try again.

With the following code, when it is executed:

//Directory where images will be stored - need to change?
$target = "images/";
$target = $target . basename( $_FILES['photo']['model']);

//Other information

// Connect to DB

mysql_connect("localhost", "", "") or die(mysql_error()) ;
mysql_select_db("yakimaimplement") or die(mysql_error()) ;

// Write information to DB

mysql_query("INSERT INTO `used_equip` VALUES ('$model', '$serial', '$application', '$pic')") ;

//Write the photo to server
if(move_uploaded_file($_FILES['photo']['tmp_name'], $target))

//Tells you if all worked
echo "The file ". basename( $_FILES['uploadedfile']['model']). " has been uploaded and your entry updated.";
else {

//Error if didn't work
echo "Sorry, there was a problem uploading your file.  Please try again.";
It doesn't seem to be a permissions problem. Again, I'm pretty new to working with SQL in PHP, so hopefully it's something simple that I'm just missing.

Thanks in advance!

MySQL - checkbox that overlays "sold" png.

14 April 2011 - 04:53 PM

I'm trying to create an script that updates an image that is displayed. Overlaying a "Sold" graphic, whenever the customer checks the "Sold" checkbox, on the update form.

Can I create a blank "sold" column in a table that can be used with a 1/0 IF statement. If the checkbox is checked, it tells the dynamic site to overlay the png file? If not, it doesn't do anything.

$link = mysql_connect('nwtillers', 'un', 'pw');
if (! $link)
die("Couldn't connect to MySQL");

mysql_select_db($db , $link)
or die("Couldn't open $db: ".mysql_error());

$query=" SELECT * FROM used_equip WHERE id='$id'";

while ($i < $num) {
<table width="600" cellpadding="10" cellspacing="0" border="2">
<tr align="center" valign="top">
<td align="center" colspan="1" rowspan="1" bgcolor="#64b1ff">
<h3>Edit and Submit</h3>
<form action="item_change_record.php" method="post">
<input type="hidden" name="ud_id" value="<? echo "$id" ?>">
Model #:<input type="text" name="ud_model" value="<? echo "$model"?>"><br />
Serial #: <input type="text" name="ud_serial" value="<? echo "$serial"?>"><br >
Application: <input type="text" name="ud_application" value="<? echo "$application"?>"><br />
<input type="checkbox" name="ud_sold" value="? idk" />  Item Sold<br />
<input type="Submit" value="Update">
<form action="item_remove.php" method="post">
<input type="Submit" value="Delete Item">


This is the update form.
Here is item_change_record.php:

$link = mysql_connect("nwtwillers", "un", "pw");
if (! $link)
die("Couldn't connect to MySQL");
mysql_select_db($db , $link)
or die("Couldn't open $db: ".mysql_error());
mysql_query(" UPDATE used_equip SET firstname='$ud_model' , lastname='$ud_serial' , birthday='$ud_application' WHERE id='$ud_id'");
echo "Record Updated.";

I'm assuming I would use an IF statement here,
to update a $ud_sold to equal 1, if the checkbox was checked?

I know this isn't very well articulated. Thank you ahead of time. Let me know if you need more information.

MySQL / PHP images question.

13 April 2011 - 11:36 AM

I'm a tad in over my head on this one, I think.
I'm not incredibly familiar with database programming and am working on an update.php file, that will allow my customer to add/edit entries for a "Used Equipment" page. The updater will allow them to upload an image, which I've decided to use a database for. My question, and forgive if it's ignorant, is do I need to make two seperate database files? One for the images and one for the text/description/etc. Or, can the images be stored in the same table with all of the text data? That would make my life easier, I assume. But, again, I'm at a loss on all this.
Many thanks!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download