Solved

uploading files to an Internet site

Posted on 2001-08-22
9
393 Views
Last Modified: 2011-09-20

In reference to a mail I read recently I discovered that using ABCUpload4 which can be downloaded from http://www.websupergoo.com/abcupload-1.htm enabled one to upload files from a client machine to a web server by installing the program onto the web server machine.  However this works fine on our intranet, but our internet site is held with a hosting company in which we cannt install/register files.
To cut a long story short does anyone know where I could find a way to upload files to our Internet??

Any ideas welcome
Regards

Louise
0
Comment
Question by:louise_8
9 Comments
 

Expert Comment

by:ArielB
ID: 6412587
0
 
LVL 33

Accepted Solution

by:
hongjun earned 75 total points
ID: 6412591
>>we cannt install/register files
Then you got to use Pure AspUpload.
See the below 2 links
http://www.pstruh.cz/help/ScptUtl/library.htm
http://www.asp101.com/articles/jacob/scriptupload.asp

hongjun
0
 
LVL 33

Expert Comment

by:hongjun
ID: 6412598
You might also wish to use Microsoft's Posting Acceptor. See below for full documentation.
http://www.webappdeveloper.com/whitepapers/Using%20MS%20Posting%20Acceptor.html

hongjun
0
 
LVL 7

Expert Comment

by:weesiong
ID: 6412599
louise_8,

Try this:
http://www.asp101.com/articles/jacob/scriptupload.asp

Regards,
Wee Siong
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 1

Expert Comment

by:adit_2k
ID: 6412726
i think aspupload is the best option.

It basically depends on the component installed by your hosting co in their server. You have to check up with them first and then only you can proceed.

It is not certain that they might be havig ASPUpload as recommended by one expert here
0
 
LVL 1

Expert Comment

by:adit_2k
ID: 6412727
It basically depends on the component installed by your hosting co in their server. You have to check up with them first and then only you can proceed.

It is not certain that they might be havig ASPUpload as recommended by one expert here
0
 
LVL 2

Expert Comment

by:turbosig
ID: 6413186
You could use PureASP, but here is a page that I use.  THere are a few variables you will need to change, namely the directory you want to store the images, I use "download". Also where it says ToFolder (I added XXXX so you could find it)

This took alot of coding, so I hope you like it.

<%
Function gen_key(digits)

     dim char_array(50)
     
     char_array(0) = "0"
     char_array(1) = "1"
     char_array(2) = "2"
     char_array(3) = "3"
     char_array(4) = "4"
     char_array(5) = "5"
     char_array(6) = "6"
     char_array(7) = "7"
     char_array(8) = "8"
     char_array(9) = "9"
     char_array(10) = "A"
     char_array(11) = "B"
     char_array(12) = "C"
     char_array(13) = "D"
     char_array(14) = "E"
     char_array(15) = "F"
     char_array(16) = "G"
     char_array(17) = "H"
     char_array(18) = "I"
     char_array(19) = "J"
     char_array(20) = "K"
     char_array(21) = "L"
     char_array(22) = "M"
     char_array(23) = "N"
     char_array(24) = "O"
     char_array(25) = "P"
     char_array(26) = "Q"
     char_array(27) = "R"
     char_array(28) = "S"
     char_array(29) = "T"
     char_array(30) = "U"
     char_array(31) = "V"
     char_array(32) = "W"
     char_array(33) = "X"
     char_array(34) = "Y"
     char_array(35) = "Z"

'Next we want to start the randomize statement.

     Randomize

'Next we loop through all of the digits to get the output.
       Dim num, output
     do while len(output) < digits
          num = char_array(Int((35 - 0 + 1) * Rnd + 0))
          output = output + num
     loop

'Now we set our output and end the function.

     gen_key = output
End Function

Response.Buffer = true
Function BuildUpload(RequestBin)
     'Get the boundary
     PosBeg = 1
     PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(13)))
     boundary = MidB(RequestBin,PosBeg,PosEnd-PosBeg)
     boundaryPos = InstrB(1,RequestBin,boundary)
     'Get all data inside the boundaries
     Do until (boundaryPos=InstrB(RequestBin,boundary & getByteString("--")))
          'Members variable of objects are put in a dictionary object
          Dim UploadControl
          Set UploadControl = CreateObject("Scripting.Dictionary")
          'Get an object name
          Pos = InstrB(BoundaryPos,RequestBin,getByteString("Content-Disposition"))
          Pos = InstrB(Pos,RequestBin,getByteString("name="))
          PosBeg = Pos+6
          PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(34)))
          Name = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
          PosFile = InstrB(BoundaryPos,RequestBin,getByteString("filename="))
          PosBound = InstrB(PosEnd,RequestBin,boundary)
          'Test if object is of file type
          If PosFile<>0 AND (PosFile<PosBound) Then
               'Get Filename, content-type and content of file
               PosBeg = PosFile + 10
               PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(34)))
               FileName = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
               'Add filename to dictionary object
               UploadControl.Add "FileName", FileName
               Pos = InstrB(PosEnd,RequestBin,getByteString("Content-Type:"))
               PosBeg = Pos+14
               PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(13)))
               'Add content-type to dictionary object
               ContentType = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
               UploadControl.Add "ContentType",ContentType
               'Get content of object
               PosBeg = PosEnd+4
               PosEnd = InstrB(PosBeg,RequestBin,boundary)-2
               Value = MidB(RequestBin,PosBeg,PosEnd-PosBeg)
               Else
               'Get content of object
               Pos = InstrB(Pos,RequestBin,getByteString(chr(13)))
               PosBeg = Pos+4
               PosEnd = InstrB(PosBeg,RequestBin,boundary)-2
               Value = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
          End If
          UploadControl.Add "Value" , Value    
          UploadRequest.Add name, UploadControl    
          BoundaryPos=InstrB(BoundaryPos+LenB(boundary),RequestBin,boundary)
     Loop
End Function

Function getByteString(StringStr)
     For i = 1 to Len(StringStr)
          char = Mid(StringStr,i,1)
          getByteString = getByteString & chrB(AscB(char))
     Next
End Function

Function getString(StringBin)
     getString =""
     For intCount = 1 to LenB(StringBin)
          getString = getString & chr(AscB(MidB(StringBin,intCount,1)))
     Next
End Function


If request("Action")="1" then
dim FileName1
'Use this to give it a random name.
FileName1 = gen_key(10)

     Response.Clear
     byteCount = Request.TotalBytes
     
     RequestBin = Request.BinaryRead(byteCount)
     
     Set UploadRequest = CreateObject("Scripting.Dictionary")

     BuildUpload(RequestBin)
     
     If UploadRequest.Item("blob").Item("Value") <> "" Then

          contentType = UploadRequest.Item("blob").Item("ContentType")
          filepathname = UploadRequest.Item("blob").Item("FileName")
          filename = Right(filepathname,Len(filepathname)-InstrRev(filepathname,"\"))
          FolderName = UploadRequest.Item("where").Item("Value")
          Path = Mid(Request.ServerVariables("PATH_TRANSLATED"), 1, Len(Request.ServerVariables("PATH_TRANSLATED")) - Len(Request.ServerVariables("PATH_INFO"))) & "\"
'Replace this XXXX with your code.
          ToFolder = Path & "\XXXX\" & FolderName
          value = UploadRequest.Item("blob").Item("Value")
          filename = ToFolder & "\" & FileName1 & "_" & replace(filename," ","_")
          Set MyFileObject = Server.CreateObject("Scripting.FileSystemObject")
          Set objFile = MyFileObject.CreateTextFile(filename)
                     
          For i = 1 to LenB(value)
               objFile.Write chr(AscB(MidB(value,i,1)))
          Next          
          objFile.Close
          Set objFile = Nothing
          Set MyFileObject = Nothing
    End If
     Set UploadRequest = Nothing
     
Session("upload") = FileName1 & "_" & Replace(Right(filepathname,Len(filepathname)-InstrRev(filepathname,"\"))," ","_")
'response.write Session("photoname")
%>
<html>
<head>
<!-- Replace your's here
<link href=css/menus.css rel=stylesheet type=text/css>
-->
</head>
<body bgcolor="#F0F2F0">
<%
            RW "<p>" & _
            "<font color=""#2a5b49"">" & _
            "<font size=3>Success</font><br>" & _
            "<br><hr color=#2a5b49<br>"
%>
      <a href="javascript:window.close();" language="javascript"><font face=verdana size=1>Close Window</a>
      
      <br><br>
      <%
      RW "File: " & Session("Upload") & " has been successfully uploaded."
      %>
</body>
</html>
<%
else
%>

<html>
<head>
<link href=css/menus.css rel=stylesheet type=text/css>
<script language="VBScript">
sub Upload_onclick
      document.all("Upload").style.display = "none"
      document.all("wait").style.display = "inline"
end sub
</script>
</head>
<body bgcolor="#F0F2F0">
<form METHOD="POST" ENCTYPE="multipart/form-data" action="Upload.asp?Action=1&next=1" name="form1" id="form1" ACCEPT="image/jpg">
<table cellspacing="0" cellpadding="3" width="100%" border="0">
     <tr>
          <td>
               <b><font >Select an image to upload: </font></b>
          </td>
            </tr>
               <tr>
          <td>
               <input size=35 class="button" TYPE="file" NAME="blob" value>
               <input TYPE="HIDDEN" NAME="where" value="download">
            </td>
            </tr>

            <tr>
          <td>
               <input TYPE="submit"  id="Upload" NAME="Upload" Value="Click to Upload" style="Display:inline;">
               <font id=wait name=wait style="Display:none;"><b>Please Wait</b></font>
          </td>
     </tr>
                  <tr>
          <td>
                              <font size=3 color=red><b>IMPORTANT:</b></font><font face=verdana style="FONT-SIZE:8pt;FONT-WEIGHT:bold;"> (Please only .jpg or .gif files)</font><BR>
          </td>
     </tr>
</table>
</form>
</body>
</html>
<%
END IF


%>
0
 
LVL 19

Expert Comment

by:webwoman
ID: 6413674
If you can't change anything on the server, and they don't have anything and won't install anything to allow for anonymous uploads, I can't see how you can allow uploads.

This isn't within your control, not really. If upload via a web form is important, then you might want to look for another hosting company.

However, if you're just talking about YOU uploading new/changed files to your internet site, any FTP client will work just fine. You'll just need info from your hosting company on how to configure it (host info, username/password, etc.)
0
 

Author Comment

by:louise_8
ID: 6414038
Thought I accepted this earlier.

anyway, I just altered the code a little to get the path where the host company stored our files -(Server.mappath)

thanks
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

758 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

17 Experts available now in Live!

Get 1:1 Help Now