Welcome Guest, Not a member yet? Register   Sign In
Upload Image
#1

[eluser]Zimooon[/eluser]
Hey guys,

Big problem . I need help .. and at the best very fast.

I work on a forum to learn CI better.
Now i want the user of the forum to have to possibilty to upload images.
Ok now the problem:
When i let him upload the image , every other input he did before (f.e. in textarea) is gone AND how can i display the uploaded image immediadetly after uploading?

I don't want you to code it just some infos how to do that.

my ideas so far:

write the upload image to a db and call this db. after calling and saving it delete the db entry. But how to get the image to the textarea view without deleting all the stuff writtenSad

upload in a popup?

Please help Smile
#2

[eluser]Rok Biderman[/eluser]
Upload is a form like any other, so it submits, reloads and obviously you lose all data in the fields. I see three ways to work around it.

One is to do a ajax upload, so the page doesn't refresh. It isn't hard, but what makes it tricky is if you have to send any additional info/processing. I just haven't found any decent upload scripts around, and I most certainly suggest you keep away from those that use swfupload scripts like uploadify. Making it work with CI (like a flash session bug fix) is an absolute nightmare and flash is impractical for debugging.

The second is to send the data along with the upload request and repopulate it later. So, you would grab put both file upload and textarea info. The in controller if file variable is empty, you put text values into database (or whatever), but if the file post variable is not empty, you do the upload event, and then use the rest of the info to repopulate the form.

The third option is as you mentioned a popup or iframe/modal popup (some ajax uploads are an masked iframe form anyway).




Theme © iAndrew 2016 - Forum software by © MyBB