FiveWeb Questions

User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Re: FiveWeb Questions

Post by Jeff Barnes »

I have the file uploading working ...

Inside dialog setup:

Code: Select all

?'<form action="../upload.php" method="post" enctype="multipart/form-data">'
    ?'<input type="file" name="file" id="file">'
    ?'<input type="submit" value="Upload Report" name="submit">'
?'</form>'
 
PHP Code:

Code: Select all

<?php
 
 $targetfolder = "PDF/";
 
 $targetfolder = $targetfolder . basename( $_FILES['file']['name']) ;
 
 $ok=1;
 
$file_type=$_FILES['file']['type'];
 
if ($file_type=="application/pdf") {
 
 if(move_uploaded_file($_FILES['file']['tmp_name'], $targetfolder))
 
 {
 
 echo "The file ". basename( $_FILES['file']['name']). " is uploaded";
 
 }
 
 else {
 
 echo "Problem uploading file";
 
 }
 
}
 
else {
 
 echo "You may only upload PDFs<br>";
 
}
 
?>
 
Thanks,
Jeff Barnes

(FWH 12.01, xHarbour 1.2.1, Bcc582)
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: FiveWeb Questions

Post by Antonio Linares »

great! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Re: FiveWeb Questions

Post by Jeff Barnes »

Using the following:

Code: Select all

?'<form action="../upload.php" method="post" enctype="multipart/form-data" target="_blank","width=600,height=400">'
    ?'<input type="file" name="file" id="file">'
    ?'<input type="submit" value="Upload Report" name="submit">'
?'</form>'
 
The file name is placed in "file"

If I do the following I get what I expect to see.

Code: Select all

MsgInfo(file.value)
But when I try to pass the value using the code below, nothing is passed.

Code: Select all

'document.getElementById( "file" ).value.trim() '
Any ideas?
Thanks,
Jeff Barnes

(FWH 12.01, xHarbour 1.2.1, Bcc582)
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Re: FiveWeb Questions

Post by Jeff Barnes »

I'm not trying to "set" the file name, I'm trying to Get it.

MsgInfo(file.value) will return "C:\fakename\myfilename.pdf"
So If MsgInfo() can get the value why not 'document.getElementById( "file" ).value.trim() ' ?

I do not require the path so I can just pull out the myfilename.pdf from what is returned.
Thanks,
Jeff Barnes

(FWH 12.01, xHarbour 1.2.1, Bcc582)
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Re: FiveWeb Questions

Post by Jeff Barnes »

"name=file" is what gets passed to upload.php
If I remove that I get errors in my upload.php file :(
Thanks,
Jeff Barnes

(FWH 12.01, xHarbour 1.2.1, Bcc582)
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Re: FiveWeb Questions

Post by Jeff Barnes »

Sorry Enrico but I'm not too familiar with php.
I added the $_POST["file"] to the php file but get an error in my php code now:

"Undefinded index: file" at the line where I added $_POST["file']

I'm still confused as to why MsgInfo() will show the correct info but I can't seem to get it any other way.
Thanks,
Jeff Barnes

(FWH 12.01, xHarbour 1.2.1, Bcc582)
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Re: FiveWeb Questions

Post by Jeff Barnes »

I think I may have not stated clearly what it is I am after.

The php code is able to get the filename submitted via my button.
The file gets uploaded. All is good on this side.

What I want to do is take the filename and add it to a field in my dbf file.

If I click the Choose file button

Code: Select all

?'<input type="file" name="file" id="file">'
Then with a button in my dialog do something like:

Code: Select all

@ x,y button ..... ACTION MsgInfo(file.value)
It will return the filename (along with "C:\fakepath" which I am ok with).

So it's on the Fiveweb code side I need to get the filename from "file.value"

Again, If it can be done with MsgInfo() it should also work with:

Code: Select all

'document.getElementById( "file" ).value.trim() '
This is where I am getting confused.

I hope that explains it clearly :oops:
Thanks,
Jeff Barnes

(FWH 12.01, xHarbour 1.2.1, Bcc582)
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: FiveWeb Questions

Post by Antonio Linares »

Jeff,
So If MsgInfo() can get the value why not 'document.getElementById( "file" ).value.trim() ' ?
I think it is cause the quotes " inside the string

Those expressions get stringfied. Please check the source code of the resulting web page and see what javascript code is there
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: FiveWeb Questions

Post by Antonio Linares »

ops, sorry, thats not the problem

Please try with:

... ACTION ... alert( document.getElementById( "file" ).value.trim() );
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Re: FiveWeb Questions

Post by Jeff Barnes »

Last part of the button used to "save" all the fields:
document.getElementById( "oGet33" ).value.trim() + ":" + document.getElementById( "file" ).value.trim() } );

Line for the MsgInfo(file.value)
$( "#oBtn4" ).click( function( event ){ MsgInfo( file.value ) } );


I tried to remove the quotes from "file" but it did not help.
Thanks,
Jeff Barnes

(FWH 12.01, xHarbour 1.2.1, Bcc582)
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Re: FiveWeb Questions

Post by Jeff Barnes »

... ACTION ... alert( document.getElementById( "file" ).value.trim() )

Does show "c:\fakename\filename.ext"

So since we can see it with both MsgInfo() and Alert(), how can I get the value into a DBF :?:
Thanks,
Jeff Barnes

(FWH 12.01, xHarbour 1.2.1, Bcc582)
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: FiveWeb Questions

Post by Antonio Linares »

Jeff,

You have to supply that value to the FiveWeb cgi app as a parameter to save it

Have you tried it ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply