0

I have a popup box when a user wants to upload csv file. In that popup box, I have a form that uploads a csv file to my database. I use iframe to display the confirmation message everytime the upload is UNSUCCESSFUL because the file needs validation before proceeding. Here's the code:

<form target="list_frame" id="create-list" method="post" enctype="multipart/form-data" action="index.php?view=lists&action=savelist">
    <label for="Listname">List Name</label>
    <input type="text" name="listname" id="listname" value="" />

    <label for="upload">Upload Emails</label>
    <input type="file" name="csv" />

    <button id="bttn-list">Upload and Save</button>

    <iframe name="list_frame" id="list_frame"></iframe>
</form>

What I would want to do now is to assign css to the iframe. I wanna put css on my confirmation message.

user3360031
  • 627
  • 4
  • 13
  • 21
  • You need to assign it not to iframe but to the document you load into the iframe – Yuriy Galanter Apr 22 '14 at 21:38
  • 2
    Why would you use an iframe to display a message? iframes were not built for that... – aldux Apr 22 '14 at 21:38
  • 3
    why are you using an iframe to display the confirmation message? Why not load() the confirmation message into a div or some other element? If you must use the iframe can you post a code example for us to manipulate? – themerlinproject Apr 22 '14 at 21:38
  • @themerlinproject it's the solution i found here in SO to use iframe when dealing with uploading of files and displaying a message WITHOUT refreshing. also, i tried using a div but it opens a new tab – user3360031 Apr 22 '14 at 21:42
  • 2
    @user - I don't know the specific example you are referring to, but there are a lot of ways to display a message without refreshing using jQuery and/or AJAX (all of them better than an iframe 99.99999999% of the time). – themerlinproject Apr 22 '14 at 21:53
  • +1 to everyone saying "Don't use iframes for this". Use AJAX. – rmehlinger Apr 22 '14 at 21:55
  • @themerlinproject i think one reason why iframe should be used in this specific problem is because you cannot upload using jquery. correct me if im wrong, though. – user3360031 Apr 22 '14 at 21:55
  • 1
    sure you can. Here is an entire jQuery plugin for uploading files: http://blueimp.github.io/jQuery-File-Upload/ – themerlinproject Apr 22 '14 at 21:57
  • here is a pretty exhaustive thread on the subject with examples and more plugins: http://stackoverflow.com/questions/166221/how-can-i-upload-files-asynchronously-with-jquery – themerlinproject Apr 22 '14 at 22:01
  • @themerlinproject thanks much! did not encounter that solution before. ;) – user3360031 Apr 22 '14 at 22:05

0 Answers0