Jump to content

How to handle images??


dustydoc

Recommended Posts

Hey,

 

I'm planning on attempting to upload images alongside my text reviews and understand storing inmages in databases is a no-no, so i was looking to use php/html to upload images from my desktop to a image folder and place a link in the database to extract the images with the text at the same time (eventually in Flash). Does this sound like the correct idea?? This is my first website!LOL!

 

1) How do i upload an image into a designated folder using html/php form??

 

2) Any tips on how to manage the images to easily reference them from a database with said text? Indices? By name?

 

3) How might i thumbnail the ideas, as to see images uploaded alongside my text before pushing all data types through a flash front end??

 

best Nich

Link to comment
Share on other sites

So once i have completed the html form:

 

1) How would i then place the image in an external folder using php??

 

2) Is it perhaps best to place all image extensions in a new database table and link text_title to image_title from my text table when extracting for display?? Or is this unneccessary and just add an extra row to my text table??

 

Link to comment
Share on other sites

1.) Did you read the link i provided? What do you mean by an 'external' folder?

 

2.) Well, that would depend on how your system is to work. If there is one piece of text per image (i.e. a caption) per image then you just want one table. If there are multiple pieces of text for each image (i.e. a commenting system), then you'll want a separate table for your images.

Link to comment
Share on other sites

Thanks for your help so far Ben much appreciated.

 

Well i think i'm a little confused, i guess i always thought you placed images in an images specific folder and then just use the <a href=""> to link and display the image, i take it i'm thinking about this wrongly??

 

Brief

I have an existing database table i can add and delete several types of text to display, from film director to film review, author, post date etc, but obviously i want to place a picture of the film cover to match with my review. Ideally i'd like to add an image as i add the text and be able to view the results as they might appear after a person has searched my webpage. I need this function as i intend to eventually allow more contributors to access and add reviews etc by themselves, as some people are in japan, some in finland, some in UK. But i'm unclear as where to even start with images. Hopefully someone on here can help.

 

best nich 

Link to comment
Share on other sites

i have found this php script to place an image into a folder on the server, but only get an error message of file not uploaded??

 

<?
$folder = "/root/phpforflash/chapter9/DocStock/Images";
if (is_uploaded_file($HTTP_POST_FILES['filename']['tmp_name']))  {   
   if (move_uploaded_file($HTTP_POST_FILES['filename']['tmp_name'], $folder.$HTTP_POST_FILES['filename']['name'])) {
        echo "File uploaded";
   } else {
        echo "File not moved to destination folder. Check permissions";
   }} else {
    echo "File is not uploaded.";
} 
?>  

Link to comment
Share on other sites

<?
$folder = "http://localhost/root/phpforflash/chapter9/DocStock/Images/";
if (is_uploaded_file($HTTP_POST_FILES['filename']['tmp_name']))  {   
   if (move_uploaded_file($HTTP_POST_FILES['filename']['tmp_name'], $folder.$HTTP_POST_FILES['filename']['name'])) {
        echo "File uploaded";
   } else {
        echo "File not moved to destination folder. Check permissions";
   }} else {
    echo "File is not uploaded.";
} 
?> 

 

From this i get an error about the HTTP not having writeable status, is that because of apache as the temporary file is created on my harddrive? Warning messages below:

 

Warning: move_uploaded_file(http://localhost/root/phpforflash/chapter9/DocStock/Images/P1000317.JPG) [function.move-uploaded-file]: failed to open stream: HTTP wrapper does not support writeable connections. in C:\Program Files\FlashInternet\xampp\htdocs\root\phpforflash\chapter9\DocStock\upload_image.php on line 4

 

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\Program Files\FlashInternet\xampp\tmp\php62.tmp' to 'http://localhost/root/phpforflash/chapter9/DocStock/Images/P1000317.JPG' in C:\Program Files\FlashInternet\xampp\htdocs\root\phpforflash\chapter9\DocStock\upload_image.php on line 4

File not moved to destination folder. Check permissions

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.