Jump to content

image upload problem


simy_ryan

Recommended Posts

<p>Hi,<br /><br />This is probably a simple question, however I am finding it difficult to accomplish. <br /><br /><?php <br /> $upload = new upload(); <br /> $upload->upload_file();<br />?><br /><br />so in a test page it would be like so:<br /><br /><?php <br /> $upload = new upload(); <br /> $upload->upload_file(); <br />?><br /><br /><br /><form action="" method="post" enctype="multipart/form-data"><br /> <input type="file" id="real_upload" name="file" /><br /> <input type="submit" id="real_submit" value="Upload" /><br /></form><br /><br />The problem is I'm using this upload system for parts of the website, what I want is to have this class upload the file once it has gone through the "gallery upload" segment:<br /><br /> <?php<br /><br /> $mysql_link = mysql_connect("localhost", "", ""); <br /> mysql_select_db("") or die("Could not select database");<br /><br /> while($counter <= count($photos_uploaded)) {<br /> if($photos_uploaded['size'][$counter] > 0) {<br /> if(!array_key_exists($photos_uploaded['type'][$counter], $known_photo_types)) {<br /> $result_final .= "File ".($counter+1)." is not a photo<br />";<br /> }<br /> else {<br /> mysql_query( "INSERT INTO gallery_photos(`photo_filename`, `photo_caption`, `photo_category`) VALUES('0', '".addslashes($photo_caption[$counter])."', '".addslashes($_POST['category'])."')" );<br /> $new_id = mysql_insert_id();<br /> $filetype = $photos_uploaded['type'][$counter];<br /> $extention = $known_photo_types[$filetype];<br /> $filename = $new_id.".".$extention;<br /><br /> mysql_query( "UPDATE gallery_photos SET photo_filename='".addslashes($filename)."' WHERE photo_id='".addslashes($new_id)."'" );<br /> }<br /><br /> ?><br />How would I approach this <a href="http://www.phpkode.com/scripts/category/php-image-galleries/">PHP Image Gallery</a> (Upload Problem)?<br /><br /><br />Thanks</p>
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...