1
lucidlee
getting hidden fields to accept default values
  • 2004/11/3 14:19

  • lucidlee

  • Just popping in

  • Posts: 33

  • Since: 2004/10/21


i've worked over "mydownloads_submit_html so that the url field is hidden and also has a default value.
[b]Old version[/b]<input type="text" name="url" size="50" maxlength="250" value="http://" />
            td>
          tr>


[b]Customised version [/b]
  <
input type="hidden" name="url" size="50" maxlength="250" value="http://.../xoops/uploads/<{$upfile}>" />
            td>


Now the submission returns:" "Error Code: 1016 - ERROR: Please enter value for URL." instead of the correct url.

How to fix?

2
ejuden01
Re: getting hidden fields to accept default values
  • 2004/11/3 15:31

  • ejuden01

  • Not too shy to talk

  • Posts: 121

  • Since: 2004/4/5 1


Part of it could be caused by having the maxlength and size attributes in there. Try taking them out and see what happens.

3
lucidlee
Re:getting hidden fields to accept default values
  • 2004/11/3 23:48

  • lucidlee

  • Just popping in

  • Posts: 33

  • Since: 2004/10/21


Well that didn't work
When I check the source in the browser it seems the URL is there except the filename is not appended. I guess the filename is not available until its uploaded and the SQL Update funtion is performed. So which file holds the code that does that?

4
Dave_L
Re:getting hidden fields to accept default values
  • 2004/11/4 0:34

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


I don't understand what your objective is.

5
lucidlee
Re:getting hidden fields to accept default values
  • 2004/11/4 1:18

  • lucidlee

  • Just popping in

  • Posts: 33

  • Since: 2004/10/21


OK my intention with the modifications to the mydownloads module are that my users can select a file from there own machine via their local file browser and that this file is transparently uploaded to the server location without them needing to specify the URL. So I've incorporated code from mydl_fileup100 that supplies the file browser, hidden the line that asks for the URL and replaced the default value of "http://" with a hard coded URL as described above.

FWIW I've now located the source of the Error 1016 also described above:
[b]from [i]mydownloads/submit.php[/i][/b]
    
// Check if URL exist
    
if (($HTTP_POST_VARS["url"]) || ($HTTP_POST_VARS["url"]!="")) {
        
$url $HTTP_POST_VARS["url"];
    }
    
// Add start by bluemooninc.biz
    
$upfile      $_FILES['upfile'];                //upload file object 
    
$upfile_tmp  $_FILES['upfile']['tmp_name'];   //tmp file name 
    
$upfile_name $_FILES['upfile']['name'];        //Local File Name 
    
$upfile_size $_FILES['upfile']['size'];       //File Size
    
$upfile_type $_FILES['upfile']['type'];       //File MIME Content-Type
    
if ($upfile_tmp != "" && ( is_object($xoopsUser) || GUEST_UPLOAD==1) ){
        if (
eregi($subtype$upfile_type)){ $deny=0; } else { $deny=1; };
        
$ext strtolower(end(explode(".",$upfile_name))); 
        if (
eregi($viri$ext)) $deny 1;
        if (
$deny==0) {
            
$upfile_localname $upfile_name;
            
$upfile_url=XOOPS_URL.UPLOADS.rawurlencode($upfile_localname);    // XOOPS_UPLOAD_URL.
            
$upfile_localname cnv_mbstr($upfile_localname);        // convert for mbstrings
            
copy($upfile_tmp,XOOPS_ROOT_PATH.UPLOADS.$upfile_localname);
            
$url $upfile_url;
        } else {
            
$url "";
        }
    }
    
// Add end
    
if ($url=="") {
        
$eh->show("1016");
    }


Now, while I understand what its trying to do I'm really stretched to understand what the detail of it means. Some seems redundant but I'm no programmer of any language, let alone php.

6
lucidlee
Re:getting hidden fields to accept default values
  • 2004/11/8 1:23

  • lucidlee

  • Just popping in

  • Posts: 33

  • Since: 2004/10/21


Bump. Am I asking for too much help?

7
khuhner
Re:getting hidden fields to accept default values
  • 2006/1/23 0:46

  • khuhner

  • Quite a regular

  • Posts: 232

  • Since: 2006/1/6 3


I have the SAME problem! What did you do to resolve it?

I commented out the 1016 code segment, which prevents the error, but now the file that was uploaded cant be read...

Login

Who's Online

293 user(s) are online (243 user(s) are browsing Support Forums)


Members: 0


Guests: 293


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits