I need to find a way to upload asynchronously multiple files.
I want to make a smtp client, User can chose files, create message and then send the mail.
I use ajaxfileupload but it create a folder witch look like c:/windows/tem/_ajaxFileUpload/[a guid]/[uploaded files]
is it possible to determine the guid and then find files to attach without saving it to an other folder.
this must be done after user click on send button.
One possible option is the HTML 5 File Api which allows client side uploads. Here is a tutorial on it http://www.html5rocks.com/en/tutorials/file/dndfiles/
I have used it in conjunction with a MVC 4 C# application, and have successfully got it to post (ajax post) file contents to an API Controller which can then be used to persist the file. While you don't mention if you are using MVC, the same should be possible using any sort of service.
Hope this helps.
Related
Is there anyone hehe who has experience with uploading very large files (3-5Gb) in Blazor and know if it works well, eg using c#, JavaScript manual shunk up files or HTML5 File API multipart upload? Preferably without a third-party library.
I also have a general question about the scenario of a logged in user if there are no special restrictions set for allowed file types possible to upload, what security concerns can still be handled using c#, JavaScript client, server side with regard to eg OWASP?
The only way I have gotten it to work properly is to make a native call to an API that is running on the same server.
You can use fetch or ajax to do so.
An example on how to use fetch: https://flaviocopes.com/how-to-upload-files-fetch
After it has been uploaded you can check the file location using dotnets file system.
You can always check the file extension however I would not recommend allowing just anyone to upload files to your website.
There is an API for virus total, I have not used it so look it through yourself!
https://github.com/Genbox/VirusTotalNet
You have to do it using pure javascript or jquery any attempt to do it using c# will use signalR and that has a very slow upload.
how can we upload images Using SignalR in asp.net MVC
i am new on it Please help me out this how we can upload and download images from SignalR chat app.
Thanks
There is no out-of-the-box method for this.
You can do that, but little more efforts are required. To achieve that you would be needing below steps:
1) First you need a server where you upload a file. For this make upload file service to send byte data (Uploading byte data tutorials can be found over google).
2) Once you upload file via web service, on success it should return the path of the server and file name (where that was saved on server).
3) After getting the path send this path as simple message (As you are already sending simple text message with Signal R). And add additional property to differentiate between normal text message of media message.
4) On receiving side (second user whom you are chatting with) check if the message has that additional property (which you added in previous step). If additional property is found, use that URL or file path to download the image from server and save it locally.
I am building an app using ASP.NET C# MVC5. You can add records to a database and these records can have images attached to them (it can be a single image for now if it makes it more complex).
I have seen some other posts on storage uploads but I don't see them working for me:
Upload File to Amazon S3
Upload files directly to Amazon S3 from ASP.NET application
How to upload a file to amazon S3 without passing it by a server?
Idea:
Upload a file (image) to Amazon S3 without the data passing through my server.
Persist any data on the form that was entered by the user (I'm happy with a post-back, modal or no-refreshing of the page)
Save a database value in a File table with the name and type of the file etc. that was uploaded (this will also be linked to the item that they are associated with)
Process:
User selects file to upload and presses upload button
File is uploaded directly to amazon (c# async method?, ajax?)
Thumbnail version is also created and uploaded to amazon using the same method? ('-thumb' is appended to filename)
Database records created with filename, amazon fileKey, fileType etc. for both files
(optional) thumbnail is then shown on-screen next to the uploader
User presses 'Save' to save the record along with the image information
When the user goes to save the item information (could be creating a new record or editing an existing one), the file information can be attached (if it isn't attached at the point of uploading the file??)
Constraints:
Avoid using client-based solution for improved app performance and accessibility across platforms (so avoid JavaScript, and definitely flash)
Minimise possibility of the user uploading a file and forgetting to save (or the browser crashing and loosing the link to the file that has been uploaded)
If I knew more about ASP.NET MVC I would have liked to have more suggestions or ideas. I wonder about using async methods or ajax calls to stop the page re-loading and loosing inputted data.
I have downloaded the Amazon SDK and built some classes around it but realised that it wasn't that useful if I'm not uploading via my app!
I took samples for client side upload from https://github.com/floatingfrisbee/amazonfileupload which was fairly useful (I managed to get it working in my app for client side uploads) but there is a lot missing from that solution to fit my problem and I would like a neat, reliable solution for my more complex problem.
Any ideas very welcome!! I'm really struggling to come up with something.
UPDATE 15.12.2016
To clarify, I would like to minimise the amount of client-side processing to the point that a low powered mobile device wouldn't struggle to process the request (obviously if the device can't handle simple image uploads then I don't need to worry).
In terms of server-side processing, the main thing I want to avoid is uploading the image via the server for bandwidth reasons, any other processing I am very happy to happen on the server.
I am developing a web application in C#.net. I need to edit a file placed on the server in browser it self(Without downloading it on local machine) and when I save that file, the changes should be reflected in file. For this I want to use google API but I don't know how can I use this.
I want to do like below.
When I click on file name, it should open in browser.
When clicked on edit, it open in edit mode in browser using google doc.
When I save that file, the changes should be reflected in my file which is placed on company server.
How can I do all this thing with google doc API?
Install Google Drive on your server.
Edit the file in Google docs, let Google Drive sync it to the local hard drive.
It is not possible for HTTP protocol, because the basics system doesn;t support it. You can open the file but the file will be downloaded to your local machine in then it will open, you have to specify the MIME type in IIS.
You can use two ways to do a similar job done.
1 By Using FTP
2 Customized solution : Make a page put a text field and load the file (.cs) in it and with submit save it to the file back.
You can embed a google doc in Webpages. But the file would be accessed and saved on Google's servers and not your company server:
Wordpress allows you to do it. Potentially you can see if it possible to do it in a similar way:
http://en.support.wordpress.com/google-docs/
I am not sure if Google has an option of accessing docs from servers outside google's domain.
I am developing an ASP.NET 3.5 web application which allows users to upload files to the server. If the user is uploading a file which is already there in the folder then I want to show a ASP.NET AJAX modal popup asking the user whether he wants to replace the existing file or not and continue the operation depending on the user's input. Is there a way to do this?
AFAIK, there is no out-of-the-box functionality to do this. You will have to check for the file existence in code and then display the question.
You don't mention whether you're uploading the file by AJAX or the good'ol fashion way. Since I doubt you'd be asking this question if you were uploading through AJAX (seeing it would be trivial to do this), I have to assume that you're not uploading through AJAX, but that you'd like an AJAX window anyway.
The only way I can think of to do that, is by checking for the file's existence through an AJAX call before you start uploading. This is because when you upload the file, there is no way for the browser to send information back until the upload is complete, and even then you can't use AJAX because the call has to be initiated as an AJAX call as well.
So:
User enters file.
BEFORE sending the file, an AJAX call is made to check whether the file exists
If file exists, ask user, submit form if user wants to replace the file and cancel otherwise.
If file does not exist, submit form.
Hope this helps!
You will need to try the upload using an AJAX call, just sending the filename - the server side method could check for file existence and respond with an error if one exists.
If no error is returned, you can proceed with the upload without the question.
If an error was returned (indicating the file exists), ask the question and follow the users response.