Hi,
I'm trying to realize a file upload action in my custom package, but it doesn't work.
I have a custom section with a custom tree. The first voice of the tree will allow users to upload an image in a custom directory in "~/Media" directory on file system
Below I show my view, controller, resource and c# code.
Can anyone help me to understand where is the problem and how to solve it?
File Upload problems in backoffice custom section
Hi, I'm trying to realize a file upload action in my custom package, but it doesn't work.
I have a custom section with a custom tree. The first voice of the tree will allow users to upload an image in a custom directory in "~/Media" directory on file system
Below I show my view, controller, resource and c# code.
Can anyone help me to understand where is the problem and how to solve it?
Thank you
Adriano
The View:
(No problem on rendering file upload fields)
The Controller:
(No problems on file selection)
The Resource
(Here I receive a "500 - Internal Server Error" after click the "upload" button. The action stops and don't reach c# code)
The C# method
Watching the header, when start upload, I receive this exception message:
No MediaTypeFormatter is available to read an object of type 'HttpPostedFile' with media type "multipart/form-data"
Any Idea? :-o
I tried to modify the code as below and finally I arrive on my POST method. The problem now is that for some reason the request.FileData is empty
Anyone can help me?
The View:
The Controller:
The Resource
The C# method
Hi Adriano,
Did you solve this issue? Can you share with our community?
Alex
This one works https://stackoverflow.com/a/53871248/2001263
Sorry for delay. I used a method similar to that you can find in the article indicated by Morten
is working on a reply...