2

thanks for all your help last week.

I have two more requests.

  1. Can you help me put the mime type that we accept. i.e. .PDF, .AI, .IDD

  2. Can we pass the mime type that has been uploaded into an input field as text?

I have attached the code we are using below.

Many thanks

Damon

<script>
$(function(){
$("#progressbar").progressbar({
value: 0
});

$("#myfile").change(function() {
if (this.value) {
    $('#localSpinner').show();
    filepicker.uploadFile(this, function(data) {
        $('#localResult').val(data.url);
        $('#localSpinner').hide();
    }, function(error) {}, function(progress) {
        $('#progressbar').progressbar('value', progress),
         $('#progressbar_text').progressbar('value', progress).text(progress+"%")
    });
}
});
});
</script>
Liyan Chang
  • 7,721
  • 3
  • 39
  • 59

1 Answers1

0

in regards to mimetypes, in the change function this.value will be set to the file that was uploaded, which should be an instance of the DOM File object (https://developer.mozilla.org/en-US/docs/DOM/File). You should be able to check this.value.name and match the extension to what you want before calling the upload.

If you want the mimetype in particular, you can use this.value.type and set it as the value of an input field of your choice

brettcvz
  • 2,371
  • 1
  • 13
  • 14
  • Thanks for the answer. If i wanted to call the filename from a url in an input into another input field how could i do that? – user1653948 Sep 10 '12 at 22:16
  • Actually all I need to do is call the filename into a field. But it won't work!!! How do i do this with the above? – user1653948 Sep 10 '12 at 22:31