httppostedfile

HttpPostedFile.FileName - Different from IE

When I upload a file to a site using the ASP:File control the FileName property is different in IE and Firefox. In Firefox, it just provides the name of the file, but IE provides the full path to the file. I have worked around this by adding the code: Dim FileName As String = file.FileName If FileName.LastIndexOf("\") > 0 Then Fil...

Getting the original files create date upon upload.

We have a process in place that uploads files to our website. It has become important to the users to be able to see when those files were created. I'm looking for a way to extract the original create date from the HttpPostedFile. If anyone has an idea for me I'd really appreciate it (I'm a bit stumped at this point). ...

How should i save a HttpPostedFile

Situation, a user MAY upload a file and MAY trigger the spam filter. If it does trigger the spam filter i save all the post data and show a captcha. If the 'bot' doesnt succeed by the time the session times out the HttpPostedFile data (which includes uploaded file) should discard. I am assuming i dont want to put the uploaded data into ...

Inconsistency in file before and after upload to Oracle DB

Hi, I'm trying to get my website to allow users to upload various files (HttpPostedFile), which are then stored in an Oracle database as BLOBs. Here's what I've got so far: public static bool insertFile(int pid, HttpPostedFile file, string filedesc) { string filename = file.FileName.Remove(0, file.FileName.LastIndexOf("\...

How to get past null characters in a file posted to an asp.net form?

I have an asp.net MVC application that takes in uploaded NMEA track files from small GPS loggers. In some cases, the loggers will inject null (0x0) values into the track file text. Is there a way to strip out these 0x0 characters from the HttpPostedFile's InputStream before saving the file to the server's file system for processing? A...

Error while installing Poster (Python Module)

I'm trying to install Chris Atlee's python Poster library so I can upload a file using a HTTP POST query from within my script. On python 2.3, when I type # python setup.py install, I get the following error. The install continues, but I can't >>> import poster later on. byte-compiling build/bdist.linux-x86_64/egg/poster/encode.py to e...

Invalid Cast Exception in HttpFileCollection

Hi Everyone, I have an extension method below, but when I run this, the foreach gives me InvalidCastException and it says * Unable to cast object of type 'System.String' to type 'System.Web.HttpPostedFile'. Code : public static List<Attachment> GetFiles(this HttpFileCollection collection) { if (collection.Count > ...

C# - I cannot reference HttpPostedFileBase

I am using MVC .NET in a distributed environment with CSLA and I can reference HttpPostedFileBase from one of my web layers (eg Website.MVC), but I cannot reference HttpPostedFileBase from a separate layer (lets call it OtherLayer.Web). Any idea on what I need to do to be able to call HttpPostedFileBase ? I am able to use HttpPostedFi...

receiving xml file via http post

Hi, I have a test script to receive an xml file via http post and it appears to work ok when I use it internally. When I move the script to a web server which can be accessed externally nothing appears to be happening. Anyone any ideas? <?php if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) { $inp = fopen("php://input"); $o...

ASP.NET MVC passing Model *together* with files back to controller

Ok, I've been going at this for several hours and I simply cannot find the solution. I want to get some data from my user. So first, I use a controller to create a view which receives a Model: public ViewResult CreateArticle() { Article newArticle = new Article(); ImagesUploadModel dataFromUser = new ImagesUploadModel(newArticl...