Taking a filename in a 'file' field for upload..

What I'm ideally trying to achieve here is to have a 'file'
field in an insert record page, where I can select a file, and
upload it to a folder on the server. I've sorted that part on it's
own at least.
But there also needs to be a text field, eg 'File_Name', in
the table so that the page can display the image.
So my question is, is it possible to browse to a file, and
have the actual file upload, but also dump the text in a
'File_Name' field automatically?
Even then, there's the issue that you wouldn't want the whole
text, but just the actual file name, as obviously the paths will be
different - this may be something the 'trim' command can take care
of?
Hope that makes sense, and that there might be a solution...
Cheers,
Iain

Thanks Steve - it's almost working - I even thought it was
working at first - file name is dropping nicely into the file_name
field - just the name without the path which is perfect.
But the files don't seem to be uploading now. I've probably
just got some things wrongly named, but I've been trying everything
without success.
At the moment I have a file upload page that looks like :
<?php require_once('Connections/Photolibrary.php'); ?>
<?php
function GetSQLValueString($theValue, $theType,
$theDefinedValue = "", $theNotDefinedValue = "")
$theValue = (!get_magic_quotes_gpc()) ?
addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" :
"NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) .
"'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" :
"NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue :
$theNotDefinedValue;
break;
return $theValue;
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" .
htmlentities($_SERVER['QUERY_STRING']);
if ((isset($_POST["MM_insert"])) &&
($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO photos (Photo_File) VALUES
(%s)",
GetSQLValueString($_FILES['file']['name'], "text"));
mysql_select_db($database_Photolibrary, $Photolibrary);
$Result1 = mysql_query($insertSQL, $Photolibrary) or
die(mysql_error());
$insertGoTo = "fileuploaded.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
header(sprintf("Location: %s", $insertGoTo));
mysql_select_db($database_Photolibrary, $Photolibrary);
$query_Recordset1 = "SELECT * FROM photos";
$Recordset1 = mysql_query($query_Recordset1, $Photolibrary)
or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<form name="form1" action="<?php echo $editFormAction;
?>" method="POST" enctype="multipart/form-data">
Type (or select) Filename: <input type="file"
name="file">
<input type="hidden" name="MAX_FILE_SIZE" value="25000"
/> <input type="submit" value="Upload file">
<input type="hidden" name="MM_insert" value="form1">
</form>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
And a fileuploaded.php page that looks like :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<?php
move_uploaded_file ($_FILES['file'] ['tmp_name'],
"Photos/{$_FILES['file'] ['name']}")
?>
File uploaded
</body>
</html>
Where 'file' is the name of the file upload field in the
first page.
Any ideas?
Iain

Similar Messages

  • To the Adobe MUSE team....Have you considered adding an "Upload File" field for the contact forms?

    To the Adobe MUSE team....Have you considered adding an "Upload File" field for the contact forms?

    But seriously...
    Is there any development being done for this?  I have a careers section on our website that I have been asked to "make easier for applicants" (right now, there is a link that just opens an email).  I'm going to make a full version of an application, but I would really like a way to upload resumes and CV's. 
    I'm going to have to look into some kind of service if this isnt something on the Muse radar.  A reply of some kind would be fantastic! 

  • One file maximum for uploads with Safari, Opera, FireFox and Chrome to OneDive

    Some Windows 7 users have complained to they can only mark one file maximum for uploading with Safari, Opera, FireFox and Chrome to OneDive

    Hi,
    You mean that you access OneDrive via web browser?
    From my tests, everything is normal and it seems there is no setting in browser to configure this number.
    if I misunderstand this issue, please give us more information on it.
    Alex Zhao
    TechNet Community Support

  • CSV file template for Uploading PO confirmaiton

    Dear all,
    We have activated Badi for Upload PO confirmations for a supplier in SNC 7.0.
    Request if any of you can please let me know where can I find the CSV upload file template.
    Thanks,
    mahesh.

    Hi Mahesh,
    You can download the CSV file from Tools-->Download center(select purchase order confirmation.
    To create a purchase order confirmation, you enter X in the To Be Confirmed column of the schedule line. If the schedule line has an X, you can change the following data:
    ■Quantity
    ■Delivery date
    Note
    Depending on the system set-up, for example if you have set up Customizing for POs to allow shipping dates to be used instead of delivery dates, you can change the shipping date.
    End of the note.
    ■Confirmed price
    Note
    If you leave the Confirmed Price field empty in all schedule lines of an item, the requested price is used. If you enter a value in the Confirmed Price field of one of the schedule lines, or in more than one schedule line, but those values are the same, the system uses that value as the confirmed price for the item. However, if you enter two or more different confirmed price values in the schedule lines of an item, the system regards this as an error, and the item is not processed.
    End of the note.
    ■Confirmed MPN
    ■Confirmed Mfr
    ■To reject the PO item, you enter an X in the To Be Rejected column of the schedule line that has an X in the Requested column.
    Now upload this file in Tools->upload center.
    See the below link for more information.
    http://help.sap.com/saphelp_snc70/helpdata/EN/b4/79223dc5b54b36899ea4f731a712f6/frameset.htm
    Regards,
    Nikhil

  • File formats for uploading/download

    Hi Experts,
    Loading of data(master/transaction) involved two steps.
    1. Loading file to Data files folder .
    2. From Data file folder to BPC application.
    For step1, what are BPC allowed file formats? Is it only .txt & .csv?
    For step2 , what are BPC allowed file formats?
    For downloading data from BPC to flat files, what are allowed file formats?
    thanx,

    Hi,
    You should be able to check the DEFAULT_EXTENSIONS parameter in the application set parameters to see what is allowed and control allowed file types. You can see the documentation on this topic here: [http://help.sap.com/saphelp_bpc75_nw/helpdata/en/f7/d21edd2f4c4f78b0a5be2b16e19ca1/frameset.htm]
    As far as file types for export, this is determined by the data manager package exporting the data. I believe the delivered data manager packages usually export in a CSV format with a file extension of your choosing, but a custom package could export data in any format required.
    Ethan

  • Mozilla takes out path of file - Problem! - need full file path for Upload

    There are pages on my site that process the uploading and storing of files (images) from the client's computer, and while IE leaves the full path of the file (like C:\myphotos\jpeg\example.jpg), Mozilla only passes the name of the file (like example.jpg), which is no good! I need to have the full path of the image file in order for it to work.
    How do I fix this issue?
    Here is a snippet of my servlet code, within the code I commented where the problem occurs...halting my servlet from continuing to process...but only in Mozilla.
    List items = upload.parseRequest(request); // Create a list of all uploaded files.                    
    Iterator it = items.iterator(); // Create an iterator to iterate through the list.                                                                                                         
    while(it.hasNext()) {                                             
         FileItem item = (FileItem)it.next();
            File f = new File(item.getName()); // Create a FileItem object to access the file.
            //THE STATEMENT BELOW HALTS THE REST OF THE SERVLET FROM PROCESSING
            //BECAUSE THE FILE PATH IS INCOMPLETE
         FileInputStream fs = new FileInputStream(f);
    //...Any input is appreciated,
    Love2Java

    BalusC wrote:
    According to your post history you've done webapps for more than 2 years. More than enough time to understand how HTTP works and so on. You even had ever posted a topic related to uploading files. Seriously, I am highly surprised.I am a self taught programmer, and yes, I have been learning code, working on my project, for quite some time, but I am not an 'expert' in ALL areas of development/programming, so excuse me if I 'lack' certain knowledge in certain areas. I'm also running/testing on a local machine, obviously, so, like I said in my last post, I didn't realize that that was the ONLY reason IE worked with my code for uploading.
    Now getting back to the topic of my post, if we could....I just want to get this problem I'm having fixed asap, so I can continue working on my project. If you will kindly continue to help me, I naturally would appreciate it.
    The download page for Apache has been fixed, and I downloaded the commons.io package, the latest. I added the .jar to the appropriate directories, and to my classpath. I must be missing something. I compiled a program and the compilation error says "cannot resolve symbol" on FileFilterUtils. What am I missing or not 'seeing'?

  • How to increase max file size for uploading

    hi i have a form that uploads a file and save it in a database..my problem is when it exceeds 2MB it doesnt save in my database. the page doesnt show any error also.
    i use multipartrequest..here is multipartrequest...
    MultipartRequest multi= new MultipartRequest(request,"/var/www/myuploads/",1000*1024, new com.oreilly.servlet.multipart.DefaultFileRenamePolicy());my application server in tomcat, and my database in mysql..
    do i need to set something in tomcat to increase the file size that i can upload?
    i need help asap..thanks in advance.

    tyr to split ur file into separated files
    and then upload them,
    it is preferable not to upload a big sized file

  • How to set the default file name for upload

    Hi All,
    I have the following BSP app for a file upload of a csv file. I want the page when displayed show the default file name to be loaded as c:\db1\currentPM.csv
    What changes do I need to make to get the default file name in the BSP app.
    Thanks
    Karen
    <%@page language="abap" %>
    <%@extension name="htmlb" prefix="htmlb" %>
    <htmlb:content id               = "content"
                   design           = "classicdesign2002design2003"
                   controlRendering = "sap"
                   rtlAutoSwitch    = "true" >
      <htmlb:page title="File Upload " >
        <htmlb:form method       = "post"
                    encodingType = "multipart/form-data">
              <htmlb:textView text   = "File:"
                              design = "STANDARD" />
              <htmlb:fileUpload id          = "uploadID"
                                onUpload    = "UploadFile"
                                upload_text ="Upload"/>
        </htmlb:form>
      </htmlb:page>
    </htmlb:content>
    On Input Processing
    event handler for checking and processing user input and
    for defining navigation
    DATA: EVENT TYPE REF TO IF_HTMLB_DATA,
          DATA TYPE REF TO CL_HTMLB_FILEUPLOAD,
          LV_OUTPUT_LENGTH TYPE I,
          LV_TEXT_BUFFER TYPE STRING,
          FILE_NAME TYPE STRING,
          FILE_PATH TYPE STRING ,
          INTERN TYPE TABLE OF  ZALSMEX_TABLINE.
    DATA: LT_BINARY_TAB TYPE TABLE OF SDOKCNTBIN .
    TYPES: BEGIN OF TY_TAB,
           FIELD1(2) TYPE C,
           FIELD2(2) TYPE C,
           FIELD3(2) TYPE C,
           FIELD4(2) TYPE C,
           FIELD5(2) TYPE C,
           END OF TY_TAB.
    DATA:  WA_TAB TYPE TY_TAB,
           IT_TAB TYPE TABLE OF TY_TAB.
    TYPES: BEGIN OF TY_LINE,
              LINE(255) TYPE C,
           END OF TY_LINE.
    DATA:  WA_LINE TYPE TY_LINE,
           IT_LINE TYPE TABLE OF TY_LINE.
    EVENT = CL_HTMLB_MANAGER=>GET_EVENT_EX( REQUEST ).
    IF EVENT IS NOT INITIAL AND EVENT->EVENT_NAME = HTMLB_EVENTS=>FILEUPLOAD.
      DATA ?= CL_HTMLB_MANAGER=>GET_DATA( REQUEST = RUNTIME->SERVER->REQUEST NAME = 'fileUpload' ID = 'uploadID' ).
      FILE_NAME = DATA->FILE_NAME.
      FILE_PATH = FILE_NAME.
      IF DATA IS NOT INITIAL.
        CALL FUNCTION'SCMS_XSTRING_TO_BINARY'
         EXPORTING BUFFER = DATA->FILE_CONTENT
         IMPORTING OUTPUT_LENGTH = LV_OUTPUT_LENGTH
         TABLES BINARY_TAB = LT_BINARY_TAB .
        CALL FUNCTION'SCMS_BINARY_TO_STRING'
        EXPORTING INPUT_LENGTH = LV_OUTPUT_LENGTH
         IMPORTING TEXT_BUFFER = LV_TEXT_BUFFER
         TABLES
         BINARY_TAB = LT_BINARY_TAB.
        IF SY-SUBRC = 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
        SPLIT LV_TEXT_BUFFER AT CL_ABAP_CHAR_UTILITIES=>CR_LF INTO TABLE IT_LINE.
        IF SY-SUBRC = 0.
          LOOP AT IT_LINE INTO WA_LINE.
           SPLIT WA_LINE AT CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB
            split wa_line at ','
            INTO WA_TAB-FIELD1 WA_TAB-FIELD2 WA_TAB-FIELD3 WA_TAB-FIELD4 WA_TAB-FIELD5.
            append wa_tab to it_tab.
          ENDLOOP.
        ENDIF.
      ENDIF.
    ENDIF.

    Also, I missed another point.
    In the folder c:\dbdata I have a number of CSV files on the user frontend. I would like the BSP application to get the list of files in the folder and process them one after the other. How can I get the list of files on the folder in the user PC and how to process them one after the other.
    I want the form to display only the default folder and once I press on upload it must process all files and display the status of processing on the same page.
    Please kindly share ideas how I can implement this app.
    Thanks
    Karen

  • Can I create an email form that includes a field for uploading and image?

    I'd like to create an email form in Muse that allows people to submit the usual text but also allows them to browse for and upload an image that would be emailed (attached or inline) to me along with the text.
    Does anyone know if there's a way to do that directly in Muse?
    Thanks.

    Which form?
    Many of the forms are created with LiveCycle ES so it might be possible to edit the form with Acrobat X Professional. If you have the data in an SQL database, you could possibly create a data connection and import the data into the form and save a copy of the completed form. You can also use the Acrobat JavaScript 'importTextData' to import a row of data from a tab delimited data file.
    You might want to talk to other Real Estate professionals to see how they are going do this. If you have a property management program, that program might have an update to perform this task.

  • Error in when No file selected For Upload Form

    Is there a way to create an upload form that when no file is
    selected to be uploaded will not return an error message even if
    the submit button is clicked?
    Thanks,
    Craig

    h2ojefe wrote:
    > Sorry for the confusion. I guess the best way for me to
    describe it, is this.
    > The customer using the website decides on certain
    critieria whom he would like
    > to send a picture
    Send a picture where, by email, to the server?
    > by first conducting a query of about 20 names (each with
    a
    > unique ID) in a database. The names of the people
    meeting the sql select
    > statement are then populated in a table, where one row
    is the name, the second
    > row is the gender, and the third row is his/her own
    unique upload form that
    > will go into her/his own directory.
    If you upload the images to the same directory you can insert
    the name
    of the image into the database and use the same path for all
    images.
    Sorry, I'm really not understanding you here at all, I'm just
    not
    getting it, which may well be my fault.
    >
    > I would like each upload form to be a named derived from
    the unique ID of the
    > 20 names,
    You could set the name to the value of the ID column in your
    database.
    >including the unique upload directory. Does that make any
    more sense?
    > Let me know because I am soooooo close and you have been
    a big help so far.
    Still not sure why you need a unique upload directory, whats
    that for?
    Cheers jojo
    Adobe Community Expert for Dreamweaver 8
    http://www.webade.co.uk
    http://www.ukcsstraining.co.uk/
    Extending Knowledge, Daily.
    http://www.communityMX.com/
    Free 10 day trial
    http://www.communitymx.com/joincmx.cfm

  • CF9 - best way to restrict file type for uploads??

    Hello, everyone.
    We're using CF9 in both dev and production environments, with little chance of upgrading to CF10 anytime in the near future (it's my understanding CF10 does have a way of detecting a file mimetype that CF9 doesn't have.)
    What is the best way to restrict uploads to specific file types in CF9?  We just need to limit uploads to primary Office (doc(x), ppt(x), xls(x), etc.), PDFs, and gif/jpg (no bmps, pngs, etc.)
    Obviously, just detecting file extension is fruitless.
    Thank you,
    ^_^

    What about just using the accept attribute? That's what it's there for. Just something like:
    <cffile
    action="upload"
    filefield="fileContent"
    accept="application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-powerpoint, application/vnd.openxmlformats-officedocument.presentationml.presentation, image/gif, application/pdf"
    etc.

  • Program  RFEBKA00(T-Code-   ff.5 ) for upload data problems

    Hi Gurus,
    Program RFEBKA00(T-Code-   ff.5  ) for upload the bank statement data and passing the with parameters.
    When execute then :
    Getting warning message     u201CWRONG PARAMETER: FILE_NAMEu201D
       Getting error message       u201CFile in disk drive can not be openu201D.
    My text file data for upload:--
    0000 01INGBNL2AXXXX00001
    0000 01INGBNL2AXXXX00001
    940 00
    :20:INGEB
    :25:0656905271                        
    :28C:132 
    :60F:C100708EUR25470,35
    :61:100709C2885,40N078
    :86:AT673200000003743077 RLNWATWW F . W Kopieranstaltbetriebs- GmbH
    :86: RG: 1001853                                                  
    :61:100709C1296,41N078
    :86:0666065284 Drukkerij Wilco BV Postbus 1477 3800 BL AMERSFOORT F
    :86:ACT.NRS 1001851                                               
    :62F:C100709EUR29652,16
    :64:C100709EUR29652,16
    :65:C100710EUR29652,16
    :65:C100711EUR29652,16
    :65:C100712EUR29652,16
    :65:C100713EUR34204,84
    :65:C100714EUR34204,84
    :65:C100715EUR34204,84
    :86:D000000C000002D0,00C4181,81
    :86:CF (Netherlands) Holding Limited BV
    -XXX
    If you have any Idea for upload data in ff.5 TCode please help.
    Subasha Sahoo

    Hi Sunita,
    If your data is in a text file , simply save the file as tab delimited.
    Then use FM 'GUI_UPOAD' to upload the file data into internal table.
    Hope this helps.
    Regards,
    Abhijeet Kapgate

  • Is it better to output t master file and then upload to youtube?

    I had to upload 33 videos to youtube today
    This has taken tooo long
    Just wondering, is it better to create a master file and then upload to youtube?
    I could maybe just copy the files to another machine and leave it to upload?
    Thanks
    Omar

    just to add:
    don't try to upload your Masterfile to YouTube!
    usually, the Masterfile is a copy of the projects timeline = proRes.
    that creates incredible large files = time for upload, wasting bandwidth, and YT will complain 'wrong settings'
    After saving a masterfile, which goes fast, you should use a 'Converter' of your choice (QuicktimePro, Mpg Streamclip, Compressor) to transcode into YT's recommended upload settings.-

  • Is there a way to simultaneously add text to Comments field for multiple files?

    Is there a way to simultaneously add text to Comments field for multiple files? I know I can use Option+Comman+i to bring up the Inspector window but it doesn't have a Comments field. For example, in iTunes you can select multiple files and change metadata for any field simultaneously and easily yet when it comes to the Comments field in the Finder, this seems to be missing.
    In our production environment, Comments field is important because we place notes about what drive the file originated then when it gets transferred to LTO-6 tape via LTFS, we can quickly trace it in the event we needed to recreate the hard drive. Because tape archiving is linear, we can't store all of the files on the same tape.
    We've tried using Apple's Automator but it too seems to not have a way to batch change text in the Comments field. Any help is appreciated.

    What is "order data"?

  • When importing photos with iBooks Gallery widget, is anyone aware of a technique for simultaneously importing the photo's description (or jpeg file name) and writing it into the iBook Author caption field for the imported photo?

    When importing photos with the iBooks Author Gallery widget, is anyone aware of a technique for simultaneously importing the photo's description (or jpeg file name) and writing it into the iBook Author caption field for the corresponding imported photo? I have 4,800 stills to import and can't imagine it's necessary to copy and paste the description for each.

    As always, feel free to use the 'Provide iBooks Author Feedback' menu item for features you'd like added in the future, etc.
    http://www.apple.com/feedback/ibooks-author.html
    As for AS, I'm not sure anyone has sniffed iBA's dictionary yet...google is you friend for hot prospects, I'm sure

Maybe you are looking for