Delete Image with PHP Script

This is a discussion on "Delete Image with PHP Script" within the PHP Forum section. This forum, and the thread "Delete Image with PHP Script are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old May 3rd, 2007, 02:23
New Member
Join Date: Mar 2007
Location: Toledo, Ohio
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Red face Delete Image with PHP Script

I have a picture uploading form that loads up a picture with information about that picture.

I have a text file that contains a tabulated line containg specific information about each picture, this information is generated by a PHP script.

I have another PHP script that reads the text file, splits the line into different variables, and prints the information in a table. The last cell of each row has a red "X" to be used for deleting the image; this red "X" is what I am trying to make work.

I am trying to develop a PHP script that will read the text file, and mark the image to be deleted. My problem is that I don't know how to make the PHP script look for the right image once the delete button on the row is clicked. The PHP script is what generates the table, so the table tags are only printed once in the PHP script; I have a while loop that prints the information, and since the information is appended to the text file, the table grows a row each time a new picture is uploaded. How will my PHP delete script know which image to delete once the user clicks the "X" at the end of the row? Can someone shed some light on this subject?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old May 3rd, 2007, 12:35
masonbarge's Avatar
Highly Reputable Member
Join Date: Jan 2006
Location: Atlanta GA
Posts: 631
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Delete Image with PHP Script

This makes my head spin a little, LOL. Maybe it's because my immediate instinct to the basic process would not include making a text file. There's something I'm not following about the program structure.

Do you want a user to be able to "mark" a photo for deletion but keep control of the actual deletion? That's what I'm reading.

Here's one idea anyway. Have a boolean field default to 0. To display the form contents for the "mark for delete" function, query the database. Let the user, possibly, hit a radio button to change the boolean field to 1. Then you can have a separate administrative form, with delete permission, that shows all rows with delete=1.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old May 3rd, 2007, 16:34
New Member
Join Date: Mar 2007
Location: Toledo, Ohio
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Angry Re: Delete Image with PHP Script

This is absolutely driving me crazy. My text file lists all the data as it pulls from the uploading form I made. All the variables that I have listed in the uploading form are what I used to generate the text file, by writing into it like this:

fputs(V\t$forpic\t$date\t$time...etc.)

This writes the information into the text file. If the file is not an image file, the V at the front of the line becomes an X instead.

The other php script that writes all of the info into the table only prints a new row of the table if the V is in the beginning of the line in the text file.

My instructor wants me to read the whole file and replace the first character of the line with the picture I want to delete with an X. But how do I know which image I will be deleting when the delete button is a picture of a red x on my table page? How can I find out which image is in the row of the table where the red x has been clicked? There is a red x at the end of each row. Does this make sense?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old May 4th, 2007, 08:32
Reputable Member
Join Date: Jul 2005
Location: Melksham, Wilts, UK
Posts: 293
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Delete Image with PHP Script

Quote:
My instructor wants me to ...
I expect that your instructor has a pretty good idea of what he/she is looking for you to do - so if your head is spinning, perhaps the best place to get clrification of the task would be from him / her ??
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
delete, php, tables

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Gah, need a javascript image resizing script. JasonStanley JavaScript Forum 3 Nov 6th, 2007 18:51
[SOLVED] Image script problem philsando JavaScript Forum 5 Oct 4th, 2007 13:58
Image Gallery Script Help r00tk1ll JavaScript Forum 4 Aug 26th, 2007 23:22
Help with PHP script that would read & delete a row from classifieds100 PHP Forum 3 May 30th, 2005 09:38
Image Upload/Delete ekendricks Classic ASP 5 Nov 18th, 2003 12:36


All times are GMT. The time now is 16:01.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42