Print Page | Close Window

AspSmartUpload -- File.saveAs not working

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=5986
Printed Date: 31 March 2026 at 3:07pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: AspSmartUpload -- File.saveAs not working
Posted By: vidyaraghav
Subject: AspSmartUpload -- File.saveAs not working
Date Posted: 26 September 2003 at 2:33am

Hi,

   I have a few files on our network server machine.I have a Personal web server with ASPsmartupload registered on it on my machine ..Actually my task is to upload the said file on to my macine's folder considering that Iam the server and the files on the network server are my clients files...Now there is no error in the program ...I tried printing the server.mappath value in the browser ...My destination also seems to be right ...But the file simply doesnt get uploaded i.e saved on to my folder which i have kept for the client..The record details correctly get added to my data base ..But the file uploading alone does'nt happen ...I wonder why?

My code is

For each file In mySmartUpload.Files

If not file.IsMissing Then

fname=file.fileName

response.write server.mappath("Pros.asp")

response.write server.mappath("../quality/clients/"&M_UserId&"/down load")

response.write fname

file.saveAs( server.mappath("../quality/clients/"&M_UserId&"/down load")&"\"&fname)

response.write "File uploaded"

End If

Next

                         Please help me




Replies:
Posted By: MorningZ
Date Posted: 26 September 2003 at 9:50am

do you get some sort of error ?

with what information you gave, no one will be able to tell you what's wrong



-------------
Contribute to the working anarchy we fondly call the Internet


Posted By: 3BEPb
Date Posted: 26 September 2003 at 11:58am

Z, probably he gets just nothing.

Vid, copy everything here, including submission form code. And, meanwhile, check folder (/download) permissions.



Posted By: vidyaraghav
Date Posted: 27 September 2003 at 2:20am

There is simply no error on the browser...The files alone do not get copied from the source ..ie our network server

      file://server/hh/d/tr/abc.doc - file://server/hh/d/tr/abc.doc

 

to  my folder namely

       c:\original\qualis\client\<client name>\upload

 



Posted By: vidyaraghav
Date Posted: 27 September 2003 at 2:37am

Let me give the whole code....

Entry  file is

<%@ Language="VBScript"%>

<%

response.buffer=true

response.expires = 0

response.expiresabsolute = Now() - 1

response.addHeader "pragma","no-cache"

response.addHeader "cache-control","private"

Response.CacheControl = "no-cache"

M_UserId = request.querystring("uid")

M_status = request.querystring("status")

if M_UserId="" OR M_UserId="null" then M_UserId ="0"%>

 

<% If M_UserId <> "0" Then %>

<form name="upload" method="post" enctype="multipart/form-data" action="Pros.asp" >

<table width="100%" border="1" cellspacing="0" cellpadding="2" bordercolorlight="#22949d" bordercolordark="#FFFFFF">

<tr>

<td align="center"><b><font color="#000066">Patient First Name</font></b></td>

<td align="center"><b><font color="#000066">Patient Last Name</font></b></td>

<td align="center"><b><font color="#000066">Dictating Doctor</font></b></td>

<td align="center"><b><font color="#000066">Date of Service</font></b></td>

<td align="center"><b><font color="#000066">MR Number </font></b></td>

<td align="center"><b><font color="#000066">Upload File </font></b></td>

</tr>

<tr>

<td>

<input type="hidden" name="userid" value="<%=M_UserId %>">

<input type="text" name="patientfname" size="9" maxlength="25">

</td>

<td>

<input type="text" name="patientlname" size="9" maxlength="25">

</td>

<td>

<input type="text" name="doctorname" size="9" maxlength="25">

</td>

<td>

<input type="text" name="middate" size="8" maxlength="10">

</td>

<td>

<input type="text" name="mid" size="6" maxlength="9">

</td>

<td>

<input type="file" name="file" size="13">

</td>

</tr>

<tr>

<td colspan="6">&nbsp;</td>

</tr>

<tr align="center">

<td colspan="6">

<input type="reset" name="Reset" value="Reset">

<input type="submit" name="Submit" value="Submit">

</td>

</tr>

</table>

</form>

<% Else %>

<center>

<b><font color="#006600">Please Select Userid to Upload files</font></b>

</center>

<% End If %>

</td>

</tr>

</table>

</td>

</tr>

</table>

<table cellspacing=0 cellpadding=0 width=760 border=0>

<tbody>

<tr>

<td><img height=5 src="../Dialpad%20-%20login_files/b.gif" width=1

border=0></td>

</tr>

<tr>

<td colspan=2>&nbsp;</td>

</tr>

<tr>

<td>&nbsp;</td>

<td align=center><span style="FONT-SIZE: 11px; COLOR: #333333">&nbsp; <br>

</span></td>

</tr>

</tbody>

</table>

The uploading file is as follows

<%@ language="vbscript" %>

<%

response.buffer=true

response.expires = 0

response.expiresabsolute = Now() - 1

response.addHeader "pragma","no-cache"

response.addHeader "cache-control","private"

Response.CacheControl = "no-cache"

%>

<%

Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")

mySmartUpload.Upload

M_UserId = replace(mySmartUpload.form("userid").values,"'","''")

M_PatientFname = replace(mySmartUpload.form("patientfname").values,"'","''")

M_PatientLname = replace(mySmartUpload.form("patientlname").values,"'","''")

M_DoctorName = replace(mySmartUpload.form("doctorname").values,"'","''")

M_MidDate = replace(mySmartUpload.form("middate").values,"'","''")

M_Mid = replace(mySmartUpload.form("mid").values,"'","''")

set con=server.createobject("ADODB.Connection")

con.open session("DSNPath")

set rsItemCount = Server.createObject("ADODB.recordset")

'------file uploading Begins here

For each file In mySmartUpload.Files

If not file.IsMissing Then

response.write "File name in files is "& file.filename&vbcrlf

fname=file.fileName

response.write "servers mappath"& server.mappath("adminuploadFilesPros.asp")&vbcrlf

response.write "place to upload to "& server.mappath("../quality/clients/"&M_UserId&"/down load")&vbcrlf

sas=server.mappath("../quality/clients/"&M_UserId&"/ download")&"\"&fname

response.write "Server mappath="& sas &vbcrlf

file.saveAs(sas)

Response.Write("Name = " & file.Name & "<BR>")

Response.Write("Size = " & file.Size & "<BR>")

Response.Write("FileName = " & file.FileName & "<BR>")

Response.Write("FileExt = " & file.FileExt & "<BR>")

Response.Write("FilePathName = " & file.FilePathName & "<BR>")

Response.Write("ContentType = " & file.ContentType & "<BR>")

Response.Write("ContentDisp = " & file.ContentDisp & "<BR>")

Response.Write("TypeMIME = " & file.TypeMIME & "<BR>")

Response.Write("SubTypeMIME = " & file.SubTypeMIME & "<BR>")

response.write "File uploaded"

End If

Next

'------file uploading ends here

 



Posted By: vidyaraghav
Date Posted: 01 October 2003 at 2:35am
can anybody please help ...I have a lot of code dependent on this aspect


Posted By: 3BEPb
Date Posted: 14 October 2003 at 12:57am

Dude, sorry for silence, I've been away for a while. I'm not sure abt the following part:

response.buffer=true

response.expires = 0

response.expiresabsolute = Now() - 1

Response.CacheControl = "no-cache"

I never really used this types of response, so I'm not sure what are they doing. Did you tried to disable them before uploading?



Posted By: vidyaraghav
Date Posted: 15 October 2003 at 4:35am

Hi ...

Thanx for replying...

   I just tried to shortlist the whole thing and write a simple code for uploading....

     trialforaspupload.asp

  

<html>

<head>

<form name="uploading" method="post" enctype="multipart/form-data" action="

Pros.asp" >

Enter name of file :<input type=file name=filename>

<input type=submit name=submit value=submit>

</head>

</html>

 

Pros.asp:-

<%@ language="vbscript" %>

<%

response.write "into pros.asp"

Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")

mySmartUpload.Upload

for each file in mysmartupload.Files

if not file.isMissing then

response.write file.filename&" File is not missing"

sas=server.mappath("../../upload")&"\"&file.filename

response.write "sas="&sas

file.saveAs(sas)

End if

next

response.write "uploading over"

 

%>

as per what instructions you had given me i.e to remove all those response. ... variables

On the browser it accepts the file name and when the pros.asp gets executed... the result is

into pros.asp00000028.doc File is not missingsas=C:\upload\00000028.docuploading over

It Gives such a positive message....

          but the file has still not got saved into

    c:\upload

What do i do?......




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net