Hello,
I have a question regarding file upload in a custom section in Umbraco.
How do I do this? I currently have a form that works as long as I use a text field, but as soon as I try to upload a file the form object stays empty. What do I need to do to get files to upload. I am trying to do it with AngularJS as per the following example: http://www.nibble.be/?p=440
If possible though, I'd rather use a normal Razor form, so if there is a way to do that then I'd like to know. :)
I have been checking the source code of Umbraco, and it seems they use FileReader upload a Base64 string to the server. Would I be correct in this assessment?
Could it have anything to do with the fact that Umbraco uses AngularJS V1.1.5? And if so, can I just add the latest version without breaking the rest of the backoffice?
Hmm, yeah I just got to the same conclusion.... Tested the app and it "works" when I isolate it out of Umbraco. So now I need to figure out what I need to change to make it work with AngularJS v1.1.5
In the end I made my own api controller. The link you provided did help me on the way, but due o version differences (I guess) I needed to do it in a slightly different way to make it work on the back end.
But it works now by using jquery to fetch the file information, then I use a formdata object to send the data to the server where I use an UmbracoApiController with an async HttpRespnseMessage task that just fetches the data from the request.files and then I handle the rest.
Custom section upload form
Hello, I have a question regarding file upload in a custom section in Umbraco.
How do I do this? I currently have a form that works as long as I use a text field, but as soon as I try to upload a file the form object stays empty. What do I need to do to get files to upload. I am trying to do it with AngularJS as per the following example: http://www.nibble.be/?p=440
If possible though, I'd rather use a normal Razor form, so if there is a way to do that then I'd like to know. :)
I have been checking the source code of Umbraco, and it seems they use FileReader upload a Base64 string to the server. Would I be correct in this assessment?
Comment author was deleted
Check out this gist https://gist.github.com/cssquirrel/3e5daad14bd2ff40edcc
That is great :) I almost have it working using that example, though I get the following error now:
Though as far as I can tell I followed the code perfectly well.
html call:
<div id="content" ng-app="storeLocatorUploadApp" ng-controller="storeLocatorUploadController">
and adding to the app:
app.controller("storeLocatorUploadController", ["$scope", "storeLocatorApiService", storeLocatorUploadController]);
And a link to the complete controller script
Do you have an idea what might be going wrong?
Comment author was deleted
Did you add a package manifest with the js files? SO that get registered when Umbraco starts?
Yeas I did, and I can see all the files as well, and they are in the same order.
Could it have anything to do with the fact that Umbraco uses AngularJS V1.1.5? And if so, can I just add the latest version without breaking the rest of the backoffice?
Comment author was deleted
Yeah if you targeted a newer version of Angular that won't work, and you can't just add a newer version
Hmm, yeah I just got to the same conclusion.... Tested the app and it "works" when I isolate it out of Umbraco. So now I need to figure out what I need to change to make it work with AngularJS v1.1.5
Can I use a custom app name, or do I need to use "Umbraco" as an app name for backoffice angular scripts?
edit: hmmm, if I try that the entirety of umbraco collapses.... Then I get the error at the main controller.
In the end I made my own api controller. The link you provided did help me on the way, but due o version differences (I guess) I needed to do it in a slightly different way to make it work on the back end.
But it works now by using jquery to fetch the file information, then I use a formdata object to send the data to the server where I use an UmbracoApiController with an async HttpRespnseMessage task that just fetches the data from the request.files and then I handle the rest.
Thanks for setting me on the path to success !
This sounds like the exact same thing I am trying to achieve! Any chance of a view of your code :-)
I have a custom section, need to allow users to upload a file which then needs to be processed / data extracted and written to a database.
If someone still struggles with this, I have just got it working:-) My receipe is here.
is working on a reply...