Jump to content

Check out our Community Blogs

Julien Duponte

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

Posts I've Made

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

28 April 2011 - 03:09 PM

Well, I gave up on that. I went over and over the code. Tried quite a number of things, but I can neither generate an error nor figure out where the problem is coming from.
I secretly assume that it does have to do with the headers. But, I want ahead and went the route of one table, uploading the image, and sending the link the to db. Which, I tried originally and was at a loss, this time around I had it running in no time. Just wanted to say thank you for all your help, it's very appreciated!

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

27 April 2011 - 11:56 PM

p.s. In your opinion, do you think that I should just have the file uploaded and the file link saved in the database so that I can just call a text link? They aren't going to have a lot of data, so I'm not too worried about the server getting filled up with data or anything. Which a lot of the anti-image-> db people mention. It's just that this method 'seemed' like the best option now that I have it working. So, I kind of want to just make this work.

Anyways. Still tinkering.

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

27 April 2011 - 11:52 PM

Hmm. I doubled checked and made an .html file that just had img codes in it and it printed out the images. So, the problem is definitely happening somewhere in the middle. It's possible that it's whitespace. I'll play around with that a little. Here's my image.php file again, just in case you see anything, otherwise I'll keep dinking around. I know I'm close, but I'm not getting any errors, other than the image not showing up.

* Display image form database
* Retrive an image from mysql database if image id is provided.
* @example to display a image with image id 1, place <img src="image.php?id=1" > in your html file.
* @author Md. Rayhan Chowdhury
* @copyright www.raynux.com
* @license LGPL

// verify request id.
if (empty($_GET['id']) || !is_numeric($_GET['id'])) {
echo 'A valid image file id is required to display the image file.';

$imageId = $_GET['id'];

//connect to mysql database
if ($conn = mysqli_connect('localhost', 'yakimaimplement', 'password', 'yakimaimplement')) {
$content = mysqli_real_escape_string($conn, $content);
$sql = "SELECT type, content FROM usedequip where id = {$imageId}";

if ($rs = mysqli_query($conn, $sql)) {
$imageData = mysqli_fetch_array($rs, MYSQLI_ASSOC);
} else {
echo "Error: Could not get data from mysql database. Please try again.";
//close mysqli connection

} else {
echo "Error: Could not connect to mysql database. Please try again.";

if (!empty($imageData)) {
// show the image.
header("Content-type: {$imageData['type']}");
echo $imageData['content'];

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

27 April 2011 - 09:05 PM

Well, it's not working. I'm assuming this has something to do with trying to run the file through php? That I can't send multiple headers? I can't figure it out. When I view the image info, it shows up as the correct link. So, I'm at a loss. Gah.

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

27 April 2011 - 08:12 PM

Oh... wait. What if I did something like this:
Print "<img src=\"image.php?id=".$info['id'] . "\">";

It's not working :) But, I feel like I'm in the right direction?

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