Jump to content

welshbryant

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

welshbryant's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. hey the bat, the last post was made in error (i had forgot to delete the public_html from the code). It says image uploaded however it uploads the php file (addphoto3 to the images folder) and not the image itself. Any idea on how to get the image itself in the folder?
  2. hey the bat, these are the error messages i receive: Warning: move_uploaded_file(/public_html/images/doggy.jpg): failed to open stream: No such file or directory in /home/welsh/public_html/addphoto3.php on line 55 Warning: move_uploaded_file(): Unable to move '/tmp/phpn64U28' to '/public_html/images/doggy.jpg' in /home/welsh/public_html/addphoto3.php on line 55 Error: 0 for the code: include("connect.php") ; $path = "/images/" ; $authname = $_POST['authorname']; $phototype = $_POST['select']; $photoitself = $_POST['filename']; $photoname = $_POST['photoname']; $photodesc = $_POST['photodescription']; if (move_uploaded_file($_FILES['filename']['tmp_name'],"/public_html/images/" . $_FILES['filename']['name'])) { echo 'Image uploaded!'; } else { echo 'Error: '.$_FILES['filename']['error']; } does this have something to do with the fopen/fread commands? and if it does what would you suggest using. Since the code above is addphoto3, it is in the public_html folder hence i removed that part from where it will be saved to just images/.
  3. Hey fellow PHPers, I am currently trying to upload an image to my mysql file server. It seems to go through however the file is never actually saved on the server. Attached is my code and hopefully someone can catch my mistake. <form name="form1" method = "post" enctype = "multipart/form-data"> Photographer name: <input type="text" name="authorname" size="40" /> <br /> Upload File: <input type="file" name="filename" id = "filename" size="40" /> <br /> File Type: <select name = "select"> <option value = "JPEG">JPEG</option> <option value = "GIF">GIF</option> <option value = "PNG">PNG</option> <option value = "other">Other</option> </select> <br /> Photo Name: <input type = "text" name = "photoname" /> <br /> Photo Description: <input type = "text" name = "photodescription" /> <br /> <input type="submit" value = "submit" /> <input type="reset" value = "reset"/> </form> <?php include("connect.php") ; $path = "/images/" ; $authname = $_POST['authorname']; $phototype = $_POST['select']; $photoitself = $_POST['filename']; $photoname = $_POST['photoname']; $photodesc = $_POST['photodescription']; move_uploaded_file($files['filename'] ['tmp_name'],"/public_html/images/" . $_FILES['filename']['name']); echo "stored in: " . "images/" . $_FILES['filename']['name']; ?> the addphoto3.php is stored under the public_html folder of my web server, and there is an images folder within the public_html where i want the images to be stored. Any help is appreciated.
  4. hey severn, i appreciate your help and can see how that would work however there is a little issue with the code you provided. When i upload the file to the database, it stores them in the databse as the blob and not in a directory on the file server. I guess i would like to know how i would go about storing the images on my file server or a workaround for having the images just stored in the database. Is there a way to find the file location (such as a php command for the server side)?
  5. Hey guys im new to the forumns and figured since it seems like people here are very knowledgable, i'd see if anyone might be able to help me find my error in my php code. I am pulling the images from a database and have verified they went in properly. Below is the code i used to upload the photo(which works) and the code for retreiving the image (which is broken). The photo is saved in a table named photo in a field named uploaded_photo. any advice on what i should do or something to try would be greatly appreciated. addphoto2.php <b> Add a Gallary</b> <form name="form1" method = "post" enctype = "multipart/form-data"> Photographer name: <input type="text" name="authorname" size="40" /> <br /> Upload File: <input type="file" name="filename" id = "filename" size="40" /> <br /> File Type: <select name = "select"> <option value = "JPEG">JPEG</option> <option value = "GIF">GIF</option> <option value = "PNG">PNG</option> <option value = "other">Other</option> </select> <br /> Photo Name: <input type = "text" name = "photoname" /> <br /> Photo Description: <input type = "text" name = "photodescription" /> <br /> <input type="submit" value = "submit" /> <input type="reset" value = "reset"/> </form> <?php include("connect.php") ; $authname = $_POST['authorname']; $phototype = $_POST['select']; $photoitself = $_POST['filename']; $photoname = $_POST['photoname']; $photodesc = $_POST['photodescription']; $image = fopen($_FILES['filename']['tmp_name'],"rb"); $readimage = fread($image,$_FILES['filename']['size']); $newimage = mysql_escape_string($readimage); $query ="INSERT INTO photo(photo_id, photo_type, photo_name, author_name, photo_description, uploaded_photo) VALUES(' ','$phototype','$photoname','$authname', '$photodesc', '$newimage')"; $result = mysql_query($query); the code for retreviing the images is testbrowse.php: <? include("imgheader.php") ; ?> <html> <head> <title>Sans Titre</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <meta name="generator" content="HAPedit 3.1"> </head> <body bgcolor="#FFFFFF"> <?php include("connect.php"); $query = "SELECT uploaded_photo FROM photo"; $results = mysql_query($query) or die(mysql_error()) ; // need to fetch the array to get this line to work: $row = mysql_fetch_assoc($results); $news = ImageCreateFromString($row['uploaded_photo']) ; $final = imagejpeg($news); echo $final; ?> when calling testbrowse.php, all i get is the box with the red x inside for a broken image link. I've been searching for answers through google however after 3 days and finding nothing i figured maybe i'd ask my fellow phpers. Thanks in advance
×
×
  • 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.