i have a script i wrote that uploads an image to the database then moves it to a directory leaving only image path in the database but when i try to display the image i does not show any help appreciated. Thanks
I just want to clarify something here.. from this code you're storing the image path to a file on the disk yet in your previous topic you state that you are using a blob and can see the blob size? Which is it and did you amend the data if you've restructured your columns? - I only ask because if picture is still containing blobs and you're rying to print file paths..
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value.
I just want to clarify something here.. from this code you're storing the image path to a file on the disk yet in your previous topic you state that you are using a blob and can see the blob size? Which is it and did you amend the data if you've restructured your columns? - I only ask because if picture is still containing blobs and you're rying to print file paths..
Sorry i am just a bit confused i only see BLOB and a size in the database. Does that mean their is nothing stored.
Right so if you're seeing a blob then you have a field that is taking blob data.
What are you putting into it - from the code you've shown above, it looks like you're storing the filename and path yet from the code in your previous topic you were storing the file itself in the blob field. Which is it?
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value.
Right so if you're seeing a blob then you have a field that is taking blob data.
What are you putting into it - from the code you've shown above, it looks like you're storing the filename and path yet from the code in your previous topic you were storing the file itself in the blob field. Which is it?
Yes i want to store the file path in the database which is link to a directory on my server. The images are stored on the server when uploaded but i can't get it to display on the front end. How can i achieve this please also how can i my the upload field not required.
Ok so you need to test the file path to the image then. You're not far from it, you've got it printing the file path into your html so now you just need to figure out whats wrong with the final path in the html.
You can copy it out and add it onto the url in the browser bar - thats one way of testing it.
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value.
Ok so you need to test the file path to the image then. You're not far from it, you've got it printing the file path into your html so now you just need to figure out whats wrong with the final path in the html.
You can copy it out and add it onto the url in the browser bar - thats one way of testing it.
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value.
Ok when i try to store the file path or name i only see this in the database: [BLOB - 59B]
As I asked you earlier, did you restructure the database (obviously no) and did you change the contents from the file itself to the filename and path instead? - Clearly this looks like no too.
You posted another topic today. In that code you were putting the actual file inside the database. Since then you've decided to use the filename / path.
When you change your mind and decide to use the filename instead of the file stream, you must delete the old files that are stored in the database and change the column from a blob to a text field instead.
I suspect the reason none of your images are showing is because instead of printing a file name and path in your html, you're trying to print a filestream instead.
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value.
As I asked you earlier, did you restructure the database (obviously no) and did you change the contents from the file itself to the filename and path instead? - Clearly this looks like no too.
You posted another topic today. In that code you were putting the actual file inside the database. Since then you've decided to use the filename / path.
When you change your mind and decide to use the filename instead of the file stream, you must delete the old files that are stored in the database and change the column from a blob to a text field instead.
I suspect the reason none of your images are showing is because instead of printing a file name and path in your html, you're trying to print a filestream instead.
Sorry i am kind of new to this.
i changed the type to varchar with a length of 255 characters but till no image.
this is what i have for my output code now
i changed the type to varchar with a length of 255 characters but till no image.
this is what i have for my output code now
A good way to debug PHP is to View Page Source and see what is missing in the HTML. I use FireFox to view the page source, I don't know about IE or Opera.
---
__________________
Leonard Whistler
Users who have thanked Len Whistler for this post: