PDA

View Full Version : php image upload shown in text area



d-machine
07-15-2008, 02:19 PM
hi

I know already how to upload files in PHP.

What I need to do is after uploading an image, to add it in a textareae on the same page.

If you didn't get me, this image should help:

http://img89.imageshack.us/img89/8998/12ju9.jpg


Thank you!

Jesdisciple
07-15-2008, 08:18 PM
Use an empty/absent ACTION attribute in your FORM and, on the same page,<textarea><?php echo file_get_contents($path_to_upload); ?></textarea> (in an 'if' to determine if anything has been uploaded first).

(BTW, that image URL times out for me, and I'm on DSL.)

EDIT: The image finally loaded, and I don't think that's possible with a traditional textarea; you'll need to use an IFRAME or scrolling DIV for that. And if the user must type into the same thing, you're wanting a WYSIWYG script; see http://www.dynamicdrive.com/dynamicindex16/openwysiwyg/index.htm.

d-machine
07-15-2008, 11:22 PM
ok, thank you

allahverdi
07-16-2008, 04:47 AM
Um, haven't tried it before. What about simply to give background to textarea with that image?

d-machine
07-16-2008, 08:33 AM
It's a nice idea but I don't want it as a background

still thanks

Jas
07-17-2008, 06:50 PM
You can't place in image in a form feild, except as a background. You could try positioning it with CSS to make it look like it's in the textarea, I suppose.