|
| |
|
|
whitney
Posts: 62 From: None Status: offline
|
Forms again - 5/6/2003 19:35:01
Hi. I have an interesting situation. Each time I make a submit form, I have this problem. All is fine and works great. I usuall set it up to send me the form by email. Again, no problem. But, each time I add an " upload Button" to the page, it fails to work and I get an error. Can I not use this to get files this way. The button is to attach files and send them to me. If I can' t then can someone tell me what I can do? thanks in advance as always. WR
|
|
|
|
abbeyvet
Posts: 5095 From: Kilkenny Ireland Status: offline
|
RE: Forms again - 5/6/2003 21:15:54
Are you using the FP 2002 Upload function? If so, it is my understanding that you have to be on a Windows server for this to work, it will not work on Linux/unix. Failing that, could you post a URL to a form?
_____________________________
Katherine :: InKK Design :: InKK Domains
|
|
|
|
whitney
Posts: 62 From: None Status: offline
|
RE: Forms again - 5/6/2003 23:32:26
It seems as though my server is Linux. Maybe that is why. I used fp2002 to insert the upload file button. I have it at http://www.interediting.com/submit.htm If I take the button off of the form, the form works fine. thanks
|
|
|
|
Gil
Posts: 7533 From: North Carolina, USA Status: offline
|
RE: Forms again - 5/7/2003 0:13:50
quote:
Maybe that is why. BINGO!!!
_____________________________
Gil Harvey, 1947-2004
|
|
|
|
caywind
Posts: 1479 From: USA Status: offline
|
RE: Forms again - 5/7/2003 1:42:38
quote:
The site www.interediting.com is running Apache/1.3.27 (Unix) mod_log_bytes/1.2 mod_bwlimited/1.0 PHP/4.3.1 FrontPage/5.0.2.2510 mod_ssl/2.8.12 OpenSSL/0.9.6b on Linux. Here' s your server statistics. You can find file upload scripts in PHP through any web search. Only catch is that you have to understand files and paths and a small amount of programming doesn' t hurt.
< Message edited by caywind -- 5/7/2003 1:45 AM >
|
|
|
|
whitney
Posts: 62 From: None Status: offline
|
RE: Forms again - 5/8/2003 4:43:43
Hi again, I downloaded something from here http://horobey.com/ but I' m not sure how to use it. Can someone help me? This is the only thing holding up this web. I simply want to use php or whatever to allow users to attach files and have the form e-mail them to me. Please help! thanks in advance wr
|
|
|
|
whitney
Posts: 62 From: None Status: offline
|
RE: Forms again - 5/9/2003 9:59:04
hi., so I am going nuts. Can someone please help me with this? I promise to later answer q' s about this same subject for you. I need an uploader to work with my server (as stated above). Guided help is needed. Its the last thing holding me up.... please please please
|
|
|
|
Jim McShane
Posts: 48 Joined: 8/13/2002 Status: offline
|
RE: Forms again - 5/9/2003 10:13:58
whitney, how are you sending e-mail??? scripting??? -jim
|
|
|
|
Jim McShane
Posts: 48 Joined: 8/13/2002 Status: offline
|
RE: Forms again - 5/9/2003 10:27:58
if using asp i found this... i need to do this sometime soon for my site too... i might be working on this later today .. but you can look at this for now... shit i can' t upload hehe... clsupload.asp <SCRIPT LANGUAGE=vbscript RUNAT=Server> Class clsUpload ' =========================================================' ' This class will parse the binary contents of the ' ' request, and populate the Form and Files collections. ' ' =========================================================' Private m_objFiles Private m_objForm Public Property Get Form() Set Form = m_objForm End Property Public Property Get Files() Set Files = m_objFiles End Property Private Sub Class_Initialize() Set m_objFiles = New clsCollection Set m_objForm = New clsCollection ParseRequest End Sub Private Sub ParseRequest() Dim lngTotalBytes, lngPosBeg, lngPosEnd, lngPosBoundary, lngPosTmp, lngPosFileName Dim strBRequest, strBBoundary, strBContent Dim strName, strFileName, strContentType, strValue, strTemp Dim objFile ' Grab the entire contents of the Request as a Byte string lngTotalBytes = Request.TotalBytes strBRequest = Request.BinaryRead(lngTotalBytes) ' Find the first Boundary lngPosBeg = 1 lngPosEnd = InStrB(lngPosBeg, strBRequest, UStr2Bstr(Chr(13))) If lngPosEnd > 0 Then strBBoundary = MidB(strBRequest, lngPosBeg, lngPosEnd - lngPosBeg) lngPosBoundary = InStrB(1, strBRequest, strBBoundary) End If If strBBoundary = " " Then ' The form must have been submitted *without* ENCTYPE=" multipart/form-data" ' But since we already called Request.BinaryRead, we can no longer access ' the Request.Form collection, so we need to parse the request and populate ' our own form collection. lngPosBeg = 1 lngPosEnd = InStrB(lngPosBeg, strBRequest, UStr2BStr(" &" )) Do While lngPosBeg < LenB(strBRequest) ' Parse the element and add it to the collection strTemp = BStr2UStr(MidB(strBRequest, lngPosBeg, lngPosEnd - lngPosBeg)) lngPosTmp = InStr(1, strTemp, " =" ) strName = URLDecode(Left(strTemp, lngPosTmp - 1)) strValue = URLDecode(Right(strTemp, Len(strTemp) - lngPosTmp)) m_objForm.Add strName, strValue ' Find the next element lngPosBeg = lngPosEnd + 1 lngPosEnd = InStrB(lngPosBeg, strBRequest, UStr2BStr(" &" )) If lngPosEnd = 0 Then lngPosEnd = LenB(strBRequest) + 1 Loop Else ' The form was submitted with ENCTYPE=" multipart/form-data" ' Loop through all the boundaries, and parse them into either the ' Form or Files collections. Do Until (lngPosBoundary = InStrB(strBRequest, strBBoundary & UStr2Bstr(" --" ))) ' Get the element name lngPosTmp = InStrB(lngPosBoundary, strBRequest, UStr2BStr(" Content-Disposition" )) lngPosTmp = InStrB(lngPosTmp, strBRequest, UStr2BStr(" name=" )) lngPosBeg = lngPosTmp + 6 lngPosEnd = InStrB(lngPosBeg, strBRequest, UStr2BStr(Chr(34))) strName = BStr2UStr(MidB(strBRequest, lngPosBeg, lngPosEnd - lngPosBeg)) ' Look for an element named ' filename' lngPosFileName = InStrB(lngPosBoundary, strBRequest, UStr2BStr(" filename=" )) ' If found, we have a file, otherwise it is a normal form element If lngPosFileName <> 0 And lngPosFileName < InStrB(lngPosEnd, strBRequest, strBBoundary) Then ' It is a file ' Get the FileName lngPosBeg = lngPosFileName + 10 lngPosEnd = InStrB(lngPosBeg, strBRequest, UStr2BStr(chr(34))) strFileName = BStr2UStr(MidB(strBRequest, lngPosBeg, lngPosEnd - lngPosBeg)) ' Get the ContentType lngPosTmp = InStrB(lngPosEnd, strBRequest, UStr2BStr(" Content-Type:" )) lngPosBeg = lngPosTmp + 14 lngPosEnd = InstrB(lngPosBeg, strBRequest, UStr2BStr(chr(13))) strContentType = BStr2UStr(MidB(strBRequest, lngPosBeg, lngPosEnd - lngPosBeg)) ' Get the Content lngPosBeg = lngPosEnd + 4 lngPosEnd = InStrB(lngPosBeg, strBRequest, strBBoundary) - 2 strBContent = MidB(strBRequest, lngPosBeg, lngPosEnd - lngPosBeg) If strFileName <> " " And strBContent <> " " Then ' Create the File object, and add it to the Files collection Set objFile = New clsFile objFile.Name = strName objFile.FileName = Right(strFileName, Len(strFileName) - InStrRev(strFileName, " \" )) objFile.ContentType = strContentType objFile.Blob = strBContent m_objFiles.Add strName, objFile End If Else ' It is a form element ' Get the value of the form element lngPosTmp = InStrB(lngPosTmp, strBRequest, UStr2BStr(chr(13))) lngPosBeg = lngPosTmp + 4 lngPosEnd = InStrB(lngPosBeg, strBRequest, strBBoundary) - 2 strValue = BStr2UStr(MidB(strBRequest, lngPosBeg, lngPosEnd - lngPosBeg)) ' Add the element to the collection m_objForm.Add strName, strValue End If ' Move to Next Element lngPosBoundary = InStrB(lngPosBoundary + LenB(strBBoundary), strBRequest, strBBoundary) Loop End If End Sub Private Function BStr2UStr(BStr) ' Byte string to Unicode string conversion Dim lngLoop BStr2UStr = " " For lngLoop = 1 to LenB(BStr) BStr2UStr = BStr2UStr & Chr(AscB(MidB(BStr,lngLoop,1))) Next End Function Private Function UStr2Bstr(UStr) ' Unicode string to Byte string conversion Dim lngLoop Dim strChar UStr2Bstr = " " For lngLoop = 1 to Len(UStr) strChar = Mid(UStr, lngLoop, 1) UStr2Bstr = UStr2Bstr & ChrB(AscB(strChar)) Next End Function Private Function URLDecode(Expression) ' Why doesn' t ASP provide this functionality for us? Dim strSource, strTemp, strResult Dim lngPos strSource = Replace(Expression, " +" , " " ) For lngPos = 1 To Len(strSource) strTemp = Mid(strSource, lngPos, 1) If strTemp = " %" Then If lngPos + 2 < Len(strSource) Then strResult = strResult & Chr(CInt(" &H" & Mid(strSource, lngPos + 1, 2))) lngPos = lngPos + 2 End If Else strResult = strResult & strTemp End If Next URLDecode = strResult End Function End Class Class clsCollection ' =========================================================' ' This class is a pseudo-collection. It is not a real ' ' collection, because there is no way that I am aware ' ' of to implement an enumerator to support the ' ' For..Each syntax using VBScript classes. ' ' =========================================================' Private m_objDicItems Private Sub Class_Initialize() Set m_objDicItems = Server.CreateObject(" Scripting.Dictionary" ) m_objDicItems.CompareMode = vbTextCompare End Sub Public Property Get Count() Count = m_objDicItems.Count End Property Public Default Function Item(Index) Dim arrItems If IsNumeric(Index) Then arrItems = m_objDicItems.Items If IsObject(arrItems(Index)) Then Set Item = arrItems(Index) Else Item = arrItems(Index) End If Else If m_objDicItems.Exists(Index) Then If IsObject(m_objDicItems.Item(Index)) Then Set Item = m_objDicItems.Item(Index) Else Item = m_objDicItems.Item(Index) End If End If End If End Function Public Function Key(Index) Dim arrKeys If IsNumeric(Index) Then arrKeys = m_objDicItems.Keys Key = arrKeys(Index) End If End Function Public Sub Add(Name, Value) If m_objDicItems.Exists(Name) Then m_objDicItems.Item(Name) = Value Else m_objDicItems.Add Name, Value End If End Sub End Class Class clsFile ' =========================================================' ' This class is used as a container for a file sent via ' ' an http multipart/form-data post. ' ' =========================================================' Private m_strName Private m_strContentType Private m_strFileName Private m_Blob Public Property Get Name() : Name = m_strName : End Property Public Property Let Name(vIn) : m_strName = vIn : End Property Public Property Get ContentType() : ContentType = m_strContentType : End Property Public Property Let ContentType(vIn) : m_strContentType = vIn : End Property Public Property Get FileName() : FileName = m_strFileName : End Property Public Property Let FileName(vIn) : m_strFileName = vIn : End Property Public Property Get Blob() : Blob = m_Blob : End Property Public Property Let Blob(vIn) : m_Blob = vIn : End Property Public Sub Save(Path) Dim objFSO, objFSOFile Dim lngLoop Set objFSO = Server.CreateObject(" Scripting.FileSystemObject" ) Set objFSOFile = objFSO.CreateTextFile(objFSO.BuildPath(Path, m_strFileName)) For lngLoop = 1 to LenB(m_Blob) objFSOFile.Write Chr(AscB(MidB(m_Blob, lngLoop, 1))) Next objFSOFile.Close End Sub End Class </SCRIPT> test.asp <%@ Language=VBScript %> <!-- #include file=" clsUpload.asp" --> <form method=post enctype=" multipart/form-data" action=test.asp> Your Name:<BR><input type=text name=YourName size=" 20" ><BR><BR> Your File:<BR><input type=file name=YourFile size=" 20" ><BR><BR> <input type=submit name=submit value=" Upload" > </form> <HR> <% Dim objUpload, lngLoop If Request.TotalBytes > 0 Then Set objUpload = New clsUpload %> File(s) Uploaded: <%= objUpload.Files.Count %> <BR><BR> <% For lngLoop = 0 to objUpload.Files.Count - 1 ' If accessing this page annonymously, ' the internet guest account must have ' write permission to the path below. objUpload.Files.Item(lngLoop).Save " c:\upload\" %> Form Element Name: <%= objUpload.Files.Key(lngLoop) %> <BR> File Name: <%= objUpload.Files.Item(lngLoop).FileName %> <BR><BR> <% Next %> Other Form Element(s): <%= objUpload.Form.Count %> <BR><BR> <% For lngLoop = 0 to objUpload.Form.Count - 1 %> Form Element Name: <%= objUpload.Form.Key(lngLoop) %> <BR> Form Element Value: <%= objUpload.Form.Item(lngLoop) %> <BR><BR> <% Next End If %> -create these pages in frontpage and look over them to change to suit your needs -jim
|
|
|
|
whitney
Posts: 62 From: None Status: offline
|
RE: Forms again - 5/10/2003 11:20:05
I need to use PHP due to my server. I am getting no where fast trying to do this myself. cant seem to find any user friendly stuff to do this with. Can anyone help me?
|
|
|
|
caywind
Posts: 1479 From: USA Status: offline
|
RE: Forms again - 5/10/2003 15:53:49
quote:
I need to use PHP due to my server. I am getting no where fast trying to do this myself. cant seem to find any user friendly stuff to do this with. Can anyone help me? Cutenews has a file upload. I don' t know if it e-mails... download the file, unzip it, print out the instructions. I think they are in a file called readme.txt. You will need to understand paths and FTP to make it work. The HFTupload is php and will probably work but it doesn' t e-mail. It has no instructions but it looks like you just edit the file hft_uploader.php. There are some instructions in this file. change the settings it says and then upload the files to your server using FTP
< Message edited by caywind -- 5/10/2003 4:08 PM >
|
|
|
|
whitney
Posts: 62 From: None Status: offline
|
RE: Forms again - 5/11/2003 5:52:21
So, I came very close to getting a couple of scripts to work but in the end, my lack of programming knowledge etc led me to fail. I will pay anyone who will help me do this. Please let me know. My web is http://www.interediting.com I have a form in there now which doesnt work because that upload component is there. As the above posts state, my server isnt gonna let it work. I need to use php. What I want is a submit form like the one I have now with the upload component there. If I can get the upload e mailed to me, the better. Please le tme know if possible and how much. thanks
|
|
|
|
whitney
Posts: 62 From: None Status: offline
|
RE: Forms again - 5/11/2003 5:55:49
Actually, if you look at this page, http://www.interediting.com/tester1.htm you will see that I put a link there. The upload component doesnt have to be in the form but can be on a seperate page. This will make it easier all around I think if I keep them seperate. WR
|
|
|
|
caywind
Posts: 1479 From: USA Status: offline
|
RE: Forms again - 5/11/2003 6:15:04
which script?
|
|
|
|
whitney
Posts: 62 From: None Status: offline
|
RE: Forms again - 5/11/2003 6:21:14
I' ' m not using any script. I threw it all out and decided to see help.
|
|
|
|
whitney
Posts: 62 From: None Status: offline
|
RE: Forms again - 5/11/2003 21:38:12
Caywind: thanks for the help. You have convinced me not to give up. I am going for it. So, I donwloaded the zip, unzipped it. made a folder and named in cutenews. I then imported all of the files to it. This is where I am now. Next, I dont understand step 3. It says, " 3) CHMOD folder_from_step1 and all files/subfolders in it to 777" How do I do this exactly in FP? I may ask more later I' m sure. Also, I' m not sure about the path. my web is http://www.interediting.com I named the folder cutenews. Shoudl it be http://www.interediting.com/cutenews/cutenews.php ? thanks in advance
|
|
|
|
whitney
Posts: 62 From: None Status: offline
|
RE: Forms again - 5/11/2003 21:50:33
something is already very wrong. I am getting this " Warning: main(./inc/functions.inc.php) [function.main]: failed to create stream: No such file or directory in /home/intered/public_html/cutenews/index.php on line 4 Fatal error: main() [function.main]: Failed opening required ' ./inc/functions.inc.php' (include_path=' ' ) in /home/intered/public_html/cutenews/index.php on line 4 wr
|
|
|
|
whitney
Posts: 62 From: None Status: offline
|
RE: Forms again - 5/11/2003 22:01:00
so, I went to my file manager of my server and made a new file called cutenews. i changed the permission to 777. I think I am going in the right direction. did I do the right thing by making a folder in FP calling it that and then putting the files into it?
|
|
|
|
whitney
Posts: 62 From: None Status: offline
|
RE: Forms again - 5/11/2003 22:41:51
ok, just an update. I think I have something happening now. I amnow at the page http://www.interediting.com/cutenews/index.php and its asking me to click and install. I think I may have it. amazing!
|
|
|
|
whitney
Posts: 62 From: None Status: offline
|
RE: Forms again - 5/11/2003 22:58:21
now, I' m stuck
|
|
|
|
whitney
Posts: 62 From: None Status: offline
|
RE: Forms again - 5/11/2003 22:59:11
can you tellme what the path shoule be? I' m still getting the error
|
|
|
|
whitney
Posts: 62 From: None Status: offline
|
RE: Forms again - 5/12/2003 0:09:33
wow, sorry about all of thepostings. I think I got it. It appears to be working. So, where is the form? do I manage all uploaded tings through the cutenews page? Curious about some of this.
|
|
|
|
whitney
Posts: 62 From: None Status: offline
|
RE: Forms again - 5/12/2003 0:32:19
ok, it could be right. http://www.interediting.com/cutenews/ lets me log in. Here is what I' m wondering. What I really wanted was an upload component. I want users to be able to upload files from their computers to me. This does do that right? If so, where from? Where is the form? I' m confused. thanks and once again, sorry about the many many posts during my stressfull day. wr
|
|
|
|
caywind
Posts: 1479 From: USA Status: offline
|
RE: Forms again - 5/12/2003 1:27:28
very good, Whitney! the upload link is on the right of the large message box. yes you manage it all through the admin.php page. Let me look at one of mine and see if I can make it email.... ** added** just noticed all of the posts, sorry, had to work!
< Message edited by caywind -- 5/12/2003 2:30 AM >
|
|
|
|
whitney
Posts: 62 From: None Status: offline
|
RE: Forms again - 5/12/2003 3:10:21
HI, but how do users log in? How can I get this form to accept anything other than images? I' d love to see an example of a web site using this code. thanks for the continued help
|
|
|
|
whitney
Posts: 62 From: None Status: offline
|
RE: Forms again - 5/12/2003 3:51:41
Hi, since I am all up to my neck in this, I figure why stop now. Say, I was to use this code below. Could someone better explain the paths and changes that need to be made in this code to suit my web? <?php /*********************************************** * Snippet Name : File Uploader * * Scripted By : Hermawan Haryanto * * Website : http://hermawan.dmonster.com * * Email : hermawan@dmonster.com * * License : GPL (General Public License) * ***********************************************/ $numoffile = 5; // Fix path of your file to be uploaded, don' t forget to CHMOD 777 to this folder $file_dir = " /home/webs/dmonster.com/subdomain/files/" ; if ($_POST) { for ($i=0;$i<$numoffile;$i++) { if (trim($_FILES[' myfiles' ][' name' ][$i])!=" " ) { $newfile = $file_dir.$_FILES[' myfiles' ][' name' ][$i]; move_uploaded_file($_FILES[' myfiles' ][' tmp_name' ][$i], $newfile); $j++; } } } if (isset($j)&&$j>0) print " Your file(s) has been uploaded.<br>" ; print " <form method=' post' enctype=' multipart/form-data' >" ; for($i=0;$i<$numoffile;$i++) { print " <input type=' file' name=' myfiles[]' size=' 30' ><br>" ; } print " <input type=' submit' name=' action' value=' Upload' >" ; print " </form>" ; ?>
|
|
|
|
caywind
Posts: 1479 From: USA Status: offline
|
RE: Forms again - 5/12/2003 10:14:09
quote:
// Fix path of your file to be uploaded, don' t forget to CHMOD 777 to this folder $file_dir = " /home/webs/dmonster.com/subdomain/files/" ; FTP these files to your server after changing the line above. You can get the path info from the panel in cutenews or you might have it from that install. Change the permissions on the folder that the users uploaded files are going to be in and away you go.
|
|
|
|
caywind
Posts: 1479 From: USA Status: offline
|
RE: Forms again - 5/12/2003 12:03:41
wow whitney, I just noticed that cutenews has a module to allow visitors to post. combined with a module for password retrieval it almost sounds like it could fill your requirement. I' m not sure how to add in the modules but in PHP sometimes it can be as easy as putting a folder into a folder...
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|