You need to sign in to do that
Don't have an account?
Daft Punk
Can I use input type="file" in place of apex:inputFile?
The majority of my VF page is built dynamically with jQuery. I'm looking to upload some attachments, I can accomplish this with inputFile, but I can't use any apex elements because everything else on the page is made with jQuery, body, tables etc...
So can I replace
<apex:inputFile value="{!attachment.body}" filename="{!attachment.name}" id="file" title="Upload Attachment" styleclass="fileType"/>
with this
<input type="file" value="{!attachment.body}" name="{!attachment.name}" id="file" accept="image/jpeg, image/png"> </input>
So can I replace
<apex:inputFile value="{!attachment.body}" filename="{!attachment.name}" id="file" title="Upload Attachment" styleclass="fileType"/>
with this
<input type="file" value="{!attachment.body}" name="{!attachment.name}" id="file" accept="image/jpeg, image/png"> </input>
All Answers
If this solves your problem, kindly mark it as the best answer.
Regards,
Magulan
http://www.infallibletechie.com
Would you possibly have any suggestions as to what might be the best approach for this?
Or perhas some sample code?
You may use a Remote Action method, which mean you can write a method in apex and may call it from JQuery, you need to pass in as parameter a base64encoded string (Convert file in base 64 ) and then in method you may decode it to upload it.
Can you please share you code sample how you achieved this I have the same scenario but not able to resolve it.
Thanks