Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 432
  • Last Modified:

uploading files to an Internet site


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
louise_8
Asked:
louise_8
1 Solution
 
hongjunCommented:
>>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
 
hongjunCommented:
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
weesiongCommented:
louise_8,

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

Regards,
Wee Siong
0
 
adit_2kCommented:
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
 
adit_2kCommented:
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
 
turbosigCommented:
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
 
webwomanCommented:
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
 
louise_8Author Commented:
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now