<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.3" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Scripting a name for myself</title>
	<link>http://www.lewismoten.com/2005/12/scripting-a-name-for-myself.html</link>
	<description>This is just a blog (web log) about me - Lewis Moten. Read along as I talk about daily happenings, movies, opinions, programming, and more.</description>
	<pubDate>Mon, 01 Dec 2008 20:47:17 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
		<item>
		<title>By: Darren Abels</title>
		<link>http://www.lewismoten.com/2005/12/scripting-a-name-for-myself.html#comment-2386</link>
		<dc:creator>Darren Abels</dc:creator>
		<pubDate>Mon, 27 Mar 2006 17:58:26 +0000</pubDate>
		<guid>http://www.lewismoten.com/2005/12/scripting-a-name-for-myself.html#comment-2386</guid>
		<description>Hello Lewis

 

My name is Darren Abels and about 6 months ago I searched the web for code to help me write a file upload process using ASP.  To be honest, I don’t exactly remember how I came across your code but it proved to be very helpful.  The reason I am e-mailing you is that I found a small problem with the code and thought you might be interested in what I found.  My level of coding is not at your level so please forgive me if I misstate anything here.

 

Everything works when I use an Internet Explorer browser but any Netscape based browser such as Netscape 7.2 or Mozilla, I have an error with the upload process.

 

In the clsUpload.asp file, in the ParseFileName function, the name of the field is parsed from the content disposition.  Here is where I found the issue.  

 

For IE – here is the value

pstrDisposition = form-data; name="txtFileLocation"; filename="C:\Documents and Settings\IIS Error.doc"

 

For Netscape – here is the value

pstrDisposition = form-data; name="txtFileLocation"; filename="IIS Error.doc"

 

The reason this turns out to be a problem is in the clsField.asp file.  When trying to retrieve the file name for the attachment that is being uploaded, see Public Property Let FilePath(ByRef pstrPath).  Here it tries to parse the file name using this code.

 

If Not InStrRev(pstrPath, “\”) = 0 then

 

Going back to what I found in the difference between IE and Netscape… this works perfect for IE since the filename passed is C:\Documents and Settings\IIS Error.doc.  It finds the last \ (backslash) and the file name is parsed and passed back to the calling code.  But with a Netscape based browser, the file name does not contain a \ (backslash) so no file name is retrieved. 

 

This was a problem since I was storing the file name in an MySQL database.

 

If I am wrong here or I missed some code that takes care of this, I apologize for bothering you.  I like to support open source code so any improvements in code that can be made, I like to participate in.  I have had so many people help me in my short web development time that I like to help when I can.

 

Also, if you have a web site that lists your code for people to use, I would be willing to post this there but like I said, I could not remember where I found this so I did not know where to go.  Just send me the URL if you want me to help.

 

Thanks and have a nice day.

Darren  

I tried e-mailing you at Lewis@Moten.com but it was rejected.

Here is the code I added to the clsField.asp file in the Let FilePath function.

 

' Parse File Name

If Not InStrRev(pstrPath, "\") = 0 Then

      FileName = Mid(pstrPath, InStrRev(pstrPath, "\") + 1)

Else

    FileName = Mid(pstrPath, 1)

End If</description>
		<content:encoded><![CDATA[<p>Hello Lewis</p>
<p>My name is Darren Abels and about 6 months ago I searched the web for code to help me write a file upload process using ASP.  To be honest, I don’t exactly remember how I came across your code but it proved to be very helpful.  The reason I am e-mailing you is that I found a small problem with the code and thought you might be interested in what I found.  My level of coding is not at your level so please forgive me if I misstate anything here.</p>
<p>Everything works when I use an Internet Explorer browser but any Netscape based browser such as Netscape 7.2 or Mozilla, I have an error with the upload process.</p>
<p>In the clsUpload.asp file, in the ParseFileName function, the name of the field is parsed from the content disposition.  Here is where I found the issue.  </p>
<p>For IE – here is the value</p>
<p>pstrDisposition = form-data; name=&#8221;txtFileLocation&#8221;; filename=&#8221;C:\Documents and Settings\IIS Error.doc&#8221;</p>
<p>For Netscape – here is the value</p>
<p>pstrDisposition = form-data; name=&#8221;txtFileLocation&#8221;; filename=&#8221;IIS Error.doc&#8221;</p>
<p>The reason this turns out to be a problem is in the clsField.asp file.  When trying to retrieve the file name for the attachment that is being uploaded, see Public Property Let FilePath(ByRef pstrPath).  Here it tries to parse the file name using this code.</p>
<p>If Not InStrRev(pstrPath, “\”) = 0 then</p>
<p>Going back to what I found in the difference between IE and Netscape… this works perfect for IE since the filename passed is C:\Documents and Settings\IIS Error.doc.  It finds the last \ (backslash) and the file name is parsed and passed back to the calling code.  But with a Netscape based browser, the file name does not contain a \ (backslash) so no file name is retrieved. </p>
<p>This was a problem since I was storing the file name in an MySQL database.</p>
<p>If I am wrong here or I missed some code that takes care of this, I apologize for bothering you.  I like to support open source code so any improvements in code that can be made, I like to participate in.  I have had so many people help me in my short web development time that I like to help when I can.</p>
<p>Also, if you have a web site that lists your code for people to use, I would be willing to post this there but like I said, I could not remember where I found this so I did not know where to go.  Just send me the URL if you want me to help.</p>
<p>Thanks and have a nice day.</p>
<p>Darren  </p>
<p>I tried e-mailing you at <a href="mailto:Lewis@Moten.com">Lewis@Moten.com</a> but it was rejected.</p>
<p>Here is the code I added to the clsField.asp file in the Let FilePath function.</p>
<p>&#8216; Parse File Name</p>
<p>If Not InStrRev(pstrPath, &#8220;\&#8221;) = 0 Then</p>
<p>      FileName = Mid(pstrPath, InStrRev(pstrPath, &#8220;\&#8221;) + 1)</p>
<p>Else</p>
<p>    FileName = Mid(pstrPath, 1)</p>
<p>End If</p>
]]></content:encoded>
	</item>
</channel>
</rss>
