You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I use a url instead of file name for the "name" property, will it work? If not, do you have any suggestions for this? (The image is stored in the server) Thanks!
I have a requirement that requires IE11 .. The problem is File object is not supported? Do you know which object I can use in javascript to replace the File ? Thanks
Hi! i have a problem trying to preview an image that is not on the same folder with my page, i would like to know if it is possible and how.
It previews normally with files(i mean image files) on the same path with the html page.
Thanks in advance...
Maybe it helps someone. Using the plugin provided above just by adding the file to the queue it doenst tigger the event uploader.onAfterAddingFile(dummy);, you have to call it manually
Hello! Sorry to bump this issue, I implemented this solution, however I couldn't not get it to refresh the list ? it does show my files if I add an item from the upload button or the drop zone.
I am using angular but I do the request with jQuery (I know it's not the angular way but I will do refactoring soon)
Another question I have is how do I remove it on the server also when I click the remove button, I looked in the code however I did not see if there is any remove item callback, sorry for bumping this, I see that other people got this working and I don't know exactly what they did, I did try to trigger the callbacks I saw (onAfterAddingFile and onAfterAddingAll) however they still don't show up.
Hi,
I am running into some issues and couldn't able to identify how to get the dataURL for the file trying to upload. Ultimately i need to get the dataURL for each file and update in the mongoDB.
In my case nothing works, I guess maybe there are recent changes in $http.get that makes all of the above code fail for me, anyway, after testing all code of the examples in this post, I was able to make it work:
var iname = data.config.url.substr(data.config.url.lastIndexOf('/') + 1);
var idata = data.data;
var itype = idata.type;
var file = new File([idata], iname, { type: itype});
uploader.addToQueue(file);
},
function() {
});
That's all, addToQueue calls to onAfterAddingFile and render.
In case you need to change file attributes like isUploaded, I think addToQueue options allow do it, but I was unable to change it, so instead I just use the next lines of code after the addToQueue call
var dummy = uploader.queue[uploader.queue.length - 1];
Activity
nervgh commentedon Aug 17, 2014
Try this
DiegoA29 commentedon Oct 20, 2014
Hi,
If I use a url instead of file name for the "name" property, will it work? If not, do you have any suggestions for this? (The image is stored in the server) Thanks!
rboughani commentedon Oct 20, 2014
For what purpose you want to change the name
DiegoA29 commentedon Oct 20, 2014
I mean... does the file have to be stored locally? Or could it be an image stored on a remote location and add it through specifying an url?
rboughani commentedon Oct 20, 2014
Maybe I misunderstood your question, but a file upload is to recover a file from a PATH (remote or on the same machine) to another PATH
The home directory can be retrieved with the angular-api file-upload and remote directory you can set it manually
i dont knew if i have answered to your question or i m out ^^
DiegoA29 commentedon Oct 20, 2014
mmmmm ok... may be I'm a bit confused. I will take a look later (I'm at work right now) and I let you know how it went. Thanks!
opiedog commentedon Dec 6, 2014
Should this approach result in the file upload control displaying 'test_file_name'?
When I use your sample code above, I see an item has been added to the uploader.queue array, but the UI doesn't show the file name.
My goal is to pre-load the UI as it would look if the user clicked Choose File and uploaded "test_file_name".
The scenario is this:
Thanks!
bushev commentedon Feb 12, 2015
Hi guys!
How to obtain FileItem from remote URL?
I already tryed:
emilhakobian commentedon Feb 25, 2015
I have the same issue , with displaying remote files (uploaded before) after page reload. I tried, but unfortunately it is not working.
mfundo commentedon Mar 5, 2015
This seemed to work for me (I'm using Angular):
Get files via $http, my JSON snippet looks like so:
"UploadedFiles": [
{
"name": "test.png",
"size": 31.5,
"dateModified": "today",
"type": "image/png"
},
{
"name": "test.png",
"size": 31.7,
"dateModified": "today",
"type": "image/png"
}
]
for(var i = 0; i < $scope.user.UploadedFiles.length; i++ ){
}
Hope this helps :)
sakram80 commentedon Aug 3, 2015
But where to put actual file object ? I want to preview files which are already uploaded ? Can somebody help me with this ?
TonyLuo commentedon Aug 5, 2015
+1 how to preview the uploaded image with url ?
TonyLuo commentedon Aug 5, 2015
finally got it. hope this code can help someone
var url = 'api/containers/comK/download/IMG_20130731_211048.jpg';
$http.get(url,{responseType: "blob"}).
success(function(data, status, headers, config) {
var mimetype = data.type;
var file = new File([data], "IMG_20130731_211048.jpg",{type:mimetype});
var dummy = new FileUploader.FileItem(imageUploader, {});
dummy._file = file;
dummy.progress = 100;
dummy.isUploaded = true;
dummy.isSuccess = true;
imageUploader.queue.push(dummy);
}).
error(function(data, status, headers, config) {
alert("The url could not be loaded...\n (network error? non-valid url? server offline? etc?)");
});
3 remaining items
tmccord commentedon Nov 20, 2015
I have been trying to show the already uploaded files into the uploader queue but it is not displaying.
sakram80 commentedon Nov 20, 2015
Put dummy FileItem inside get request, then it will work fine ...
vlzkonopatov commentedon Dec 1, 2015
everything is fine but would also add to the image displayed ?
Condor2708 commentedon Dec 16, 2015
I have a requirement that requires IE11 .. The problem is File object is not supported? Do you know which object I can use in javascript to replace the File ? Thanks
alkaj commentedon Apr 17, 2016
Hi! i have a problem trying to preview an image that is not on the same folder with my page, i would like to know if it is possible and how.
It previews normally with files(i mean image files) on the same path with the html page.
Thanks in advance...
alvaromlg commentedon Jul 19, 2016
Maybe it helps someone. Using the plugin provided above just by adding the file to the queue it doenst tigger the event uploader.onAfterAddingFile(dummy);, you have to call it manually
xkidro commentedon Sep 13, 2016
Hello! Sorry to bump this issue, I implemented this solution, however I couldn't not get it to refresh the list ? it does show my files if I add an item from the upload button or the drop zone.
I am using angular but I do the request with jQuery (I know it's not the angular way but I will do refactoring soon)
Another question I have is how do I remove it on the server also when I click the remove button, I looked in the code however I did not see if there is any remove item callback, sorry for bumping this, I see that other people got this working and I don't know exactly what they did, I did try to trigger the callbacks I saw (onAfterAddingFile and onAfterAddingAll) however they still don't show up.
thanks in advance.
xkidro commentedon Sep 15, 2016
Hello guys, I managed to solve the problem, you just need to call uploader._render(); after you add to the queue.
data is my file array
saivasu007 commentedon Oct 29, 2016
Hi,
I am running into some issues and couldn't able to identify how to get the dataURL for the file trying to upload. Ultimately i need to get the dataURL for each file and update in the mongoDB.
Appreciated your help on this.
gerome0123 commentedon Mar 14, 2017
@xkidro can you create a jsfiddle so i can understand more thanks 😘
gerome0123 commentedon Mar 14, 2017
@mfundo hi sir do u have a jsfiddle so i can undestand more thanks
xkidro commentedon Mar 14, 2017
@gerome0123 I can't make a jsfiddle, here is the full controler.
gerome0123 commentedon Mar 22, 2017
@xkidro thanks for the reply can i see your view?
miraghe commentedon Oct 1, 2017
In my case nothing works, I guess maybe there are recent changes in $http.get that makes all of the above code fail for me, anyway, after testing all code of the examples in this post, I was able to make it work:
var url = 'directory/imagen.jpg';
$http.get(url, { responseType: "blob" }).then(
function(data, status, headers, config) {
var iname = data.config.url.substr(data.config.url.lastIndexOf('/') + 1);
var idata = data.data;
var itype = idata.type;
var file = new File([idata], iname, { type: itype});
uploader.addToQueue(file);
},
function() {
});
That's all, addToQueue calls to onAfterAddingFile and render.
In case you need to change file attributes like isUploaded, I think addToQueue options allow do it, but I was unable to change it, so instead I just use the next lines of code after the addToQueue call
var dummy = uploader.queue[uploader.queue.length - 1];
dummy.progress = 100;
dummy.isUploaded = true;
dummy.isSuccess = true;
Hope that helps someone.
th3v0ice commentedon Oct 12, 2017
If you want to have $_FILES populated inside the PHP once you submit the data, you need to add the
var file =...lines from the code snippet below.