Solved

Questions about few problems with ASP script

Posted on 2004-08-16
6
149 Views
Last Modified: 2010-04-06

I have created a script that uploads a file. When it is uploaded, the filename gets stored in the database. It all works locally. However, when I put the script and database on the remote server. It doesn't seem to upload. Moreover, my form validations says that the file doesn't exist. The path where the files get stored localed is stated with a path of "c:\file\upload." The same folders are set with on the server too. I have even given iuser permissions to read/write...  Any ideas why doesn't work. I'm thinking it's the path of the folder. Maybe, it can't find the folder.

Another question, the script can't seem to retrieve the information from the database. It retrieves the data from another database which isn't even pointing to it on the script. Does anyone know why this is happening? It works locally. But when I up the script and database to a remote server, this happens. It  can't seem to find the database where I set it.
0
Comment
Question by:onL0oker
  • 3
  • 2
6 Comments
 
LVL 15

Expert Comment

by:joeposter649
ID: 11816500
Are you using server.mappath to reference your upload and mdb files?
0
 

Author Comment

by:onL0oker
ID: 11816951

This is my script that uploads a file with conditions set. I'm not server mapping the path. Am I suppose to use server.map?

      <%
      Set Upload = Server.CreateObject("Persits.Upload.1")
      
      uploaddir = "c:\files\upload\"
      Upload.OverwriteFiles = False
      Upload.SaveToMemory

      Upload.Save(uploaddir)
      
      'checks for word document files, will reject if anything else
    For Each File in Upload.Files
      Filename = File.ExtractFilename
    Ext = UCase(Right(File.Path, 3))
      Size = File.Size

    If Not(Ext = "DOC") Then
            Response.write ("<script language=""javascript"">")                    'Better to user Javascript
            Response.write ("{alert(""Please submit Microsoft Word documents (*.doc) only!"")}")
            Response.write "javascript:history.back();"
            Response.write ("</script>")
      Else
            File.Copy("c:\files\upload\") & Filename ' & Session("directory") & "\"
            Session("wdstoryURL") = Filename
      End If
      
      Next
%>

The database is pretty much called through a include file which contains the dsn. I'm not server.mapping the mdb either. How do I map the mdb through the include file and also how do I server map the path for the upload script? How would I implement it base on what I have? Thanks.
0
 

Author Comment

by:onL0oker
ID: 11817022

Let me clear up the remote server. It is not exactly remote. It's pretty much a network. On my local machine, it works fine. Users could upload, and vew the retrieve information from the database perfectly.

But when I copy the files over the network to another computer. The database has also been setup for the script as well on that computer. It doesn't work. The script states the actual path of the directory where the upload files suppose to go. Do I really need to server map the path? Shouldn't it work because the script resides where the database and the actual path is at?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 15

Expert Comment

by:joeposter649
ID: 11817191
shouldn't this
File.Copy("c:\files\upload\") & Filename
be
File.Copy("c:\files\upload\" & Filename)
0
 

Accepted Solution

by:
TimRay15 earned 125 total points
ID: 11833085
A couple of points here - the ASPUpload method SaveToMemory has now been superceeded by calling Save with no path parameter i.e. in your case:
Upload.Save
(assuming you're not using version 2 in which case you are correct!)

Also, according my own use of ASPUpload, the File.Copy statement shouldn't have any brackets at all!

On a more general note, the example code in the user manual on the ASPUpload site (http://www.aspupload.com/manual_memory.html) would suggest that hard-coded directories are fine, and in fact I'm using (to borrow your object name) Upload.SaveVirtual("images/") to write to a virtual directory without needing Server.MapPath at all.  You might find the following code from the above manual page helpful as well:


Set Upload = Server.CreateObject("Persits.Upload")
' we use memory uploads, so we must limit file size
Upload.SetMaxSize 100000, True

' Save to memory. Path parameter is omitted
Upload.Save

' Access subdirectory specified by user
subdir = Upload.Form("subdir")

' Build path string
Path = "c:\upload\" & subdir

' Create path, ignore "already exists" error
Upload.CreateDirectory Path, True

' Save files to it. Our form has only one file item
' but this code is generic.
For Each File in Upload.Files
   File.SaveAs Path & "\" & File.FileName
   Response.Write "File saved as " & File.Path & "<BR>"
Next


There are a number of useful examples in the other manual pages as well, so I would suggest having a look and seeing which most closely matches what you need.

As for writing to the wrong database, have you checked that the dsn is set up properly on the server? (a favourite mistake of mine...)
0
 

Author Comment

by:onL0oker
ID: 11833469

I have already figured out the problem. Thanks.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Perl 101 11 72
How to run a side-by-side staging website 16 61
Question on web subscription for apps 3 89
Form submit issue 11 80
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

947 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now