Conditional csv file upload

I would like to upload a csv file conditionally - so only if it is a file with the extension .csv. How can I put the regular expression validation into HTMLDB or, more exactly, in the File Browse text field??
Thank you for any assistance!
Tom

Vikas
If anyone's interested, my final, finally working, code to validate the length of a file name for uploading. I didn't know the \ was an escape character so that took another couple hours to figure out!
I did discover that the limit on file name characters is 74. Not sure why but I had to use 78 in the javascript to correspond to a 74 character filename.
Bill
function checkLength()
var p_file_name = document.getElementsByName('p_t05')[0].value
var p_index = p_file_name.lastIndexOf("\\")
p_file_name = p_file_name.substring(p_index+1)
var p_length = p_file_name.length
if (p_length > 78)
{alert("The file name is too long. Please rename it with 74 characters or less.")}
else
{doSubmit('UPLOAD')}
}

Similar Messages

  • Error message when CSV file link to datasource(CSV file upload to BW)

    hello friends,
    I have met one problem when i upload CSV file to BW, i want to show the error screenshot, how can i show it in this website?
    Please help me analysis it base below error message;
    tks;
    below is my steps
    1.create datasource;
    2.general info tab, input description
    3. extraction tab, input file name, value of data format is separated with separator (for example CSV),data separator is ,
    4.proposal tab, click "load example data",it can show correct data the same as CSV file;
    5.when i click fields tab, Popup show"field list no longer corresponds to dafault copy change? "Yes" or "NO" button"
    6.Click Yes, fields tab show correct data;
    7.click "read preview data " in preview Tab, show error infomation;
    ---Runtime error -description of exception;
    Runtime errors           Data_length_negative
    Except.                       CX_XY_RANGE_OUT_OF_BOUNDS
    short text             Invailid partial field access :length negative
    what happened  Errpr in the ABAP application  program
                                The current Abap program "CL_RSAR_PSA==============CP " has to be terminated bacause it has
                                come across a statement that unfortunately can't be executed.
    Error analysis
       An exception occured that is

    Please see the error message;
    Runtime Errors         DATA_LENGTH_NEGATIVE
    Except.                CX_SY_RANGE_OUT_OF_BOUNDS
    Date and Time          09/04/2009 21:34:14
    Short text
    Invalid partial field access: Length negative
    What happened?
    Error in the ABAP Application Program
    The current ABAP program "CL_RSAR_PSA===================CP" had to be
    terminated because it has
    come across a statement that unfortunately cannot be executed.
    What can you do?
    Note down which actions and inputs caused the error.
    To process the problem further, contact you SAP system
    administrator.
    Using Transaction ST22 for ABAP Dump Analysis, you can look
    at and manage termination messages, and you can also
    keep them for a long time.
    Error analysis
    An exception occurred that is explained in detail below.
    The exception, which is assigned to class 'CX_SY_RANGE_OUT_OF_BOUNDS', was not
    caught in
    procedure "_GET_DDIC_STRUCTURE" "(METHOD)", nor was it propagated by a RAISING
    clause.
    Since the caller of the procedure could not have anticipated that the
    exception would occur, the current program is terminated.
    The reason for the exception is:
    In the executed program "CL_RSAR_PSA===================CP", the system
    attempted to access the field
    "ME->P_PSA_TECHNAME" using the length "-3".
    However, a partial field access with a negative length specification is
    not allowed.
    How to correct the error
    Use a positive length specification if a part of the field "ME->P_PSA_TECHNAME"
    is to be
    accessed.
    If the error occurred in your own ABAP program or in an SAP
    program you modified, try to remove the error.
    If the error occures in a non-modified SAP program, you may be able to
    find an interim solution in an SAP Note.
    If you have access to SAP Notes, carry out a search with the following
    keywords:
    "DATA_LENGTH_NEGATIVE" "CX_SY_RANGE_OUT_OF_BOUNDS"
    "CL_RSAR_PSA===================CP" or "CL_RSAR_PSA===================CM00A"
    "_GET_DDIC_STRUCTURE"
    If you cannot solve the problem yourself and want to send an error
    notification to SAP, include the following information:
    1. The description of the current problem (short dump)
    To save the description, choose "System->List->Save->Local File
    (Unconverted)".
    2. Corresponding system log
    Display the system log by calling transaction SM21.
    Restrict the time interval to 10 minutes before and five minutes
    after the short dump. Then choose "System->List->Save->Local File
    (Unconverted)".
    3. If the problem occurs in a problem of your own or a modified SAP
    program: The source code of the program
    In the editor, choose "Utilities->More
    Utilities->Upload/Download->Download".
    4. Details about the conditions under which the error occurred or which
    actions and input led to the error.
    The exception must either be prevented, caught within proedure
    "_GET_DDIC_STRUCTURE" "(METHOD)", or its possible occurrence must be declared
    in the
    RAISING clause of the procedure.
    To prevent the exception, note the following:

  • CSV FILE UPLOAD

    DEAR ALL,
    I am facing one problem while uploading csv file.
    I have 2 csv files.
    i use the function module
    CALL FUNCTION 'KCD_CSV_FILE_TO_INTERN_CONVERT'
        EXPORTING
          i_filename      = L_FILENAME "'C:\Temp\Book1.csv'
          i_separator     = ','
        TABLES
          e_intern        = l_intern
        EXCEPTIONS
          upload_csv      = 1
          upload_filetype = 2.
      LOOP AT l_intern.
        MOVE : l_intern-col TO v_index.
        ASSIGN COMPONENT v_index OF STRUCTURE W_ERQ TO <fs>.
        MOVE : l_intern-value TO <fs>.
        AT END OF row.
          APPEND W_ERQ TO GT_ERQ.
          CLEAR W_ERQ.
        ENDAT.
      ENDLOOP.
    It is working working for one file. while uploading another file it is showing simble (") " with mail ids"
    In the sence i have my csv files one column mail id of approver. But it is fetching from csv file mail-ids but starting mail with " and end of mail it showing the simble ".
    HOw should i over come this problem
    Thanks
    margani

    If your CSV has tabulator as separetor, this code will fill your internal table without any other code.
    DATA: l_filename TYPE string.
      l_filename = p_file.
      REFRESH wt_input.
    CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                      = l_filename
         filetype                      = 'ASC'
         has_field_separator           = 'X'
         dat_mode                      = 'X'
        TABLES
          data_tab                      = wt_input[]
       EXCEPTIONS
         file_open_error               = 1
         file_read_error               = 2
         no_batch                      = 3
         gui_refuse_filetransfer       = 4
         invalid_type                  = 5
         no_authority                  = 6
         unknown_error                 = 7
         bad_data_format               = 8
         header_not_allowed            = 9
         separator_not_allowed         = 10
         header_too_long               = 11
         unknown_dp_error              = 12
         access_denied                 = 13
         dp_out_of_memory              = 14
         disk_full                     = 15
         dp_timeout                    = 16
         OTHERS                        = 17
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.

  • Csv file uploading for database table creation

    Hi there,
    I'm in the process of making an application that will be able to upload a csv file and create a table based on the same file. As of now, I have managed to make my application upload a csv file into the database. My problem now is to transfer the data in the csv into a table. If there is a function that can do this, please let me know. But as of now, I have tried all that I can but in vain. I would appreciate any assistance rendered as to how I can go about this.
    Kind regards,
    Lusuntha

    hai Lusuntha ,
    Go to search forum and type "upload within html db".here u will find the required information ,as well as the code.go for each topic in the search result.

  • CSV file upload into interal table with unicode system.

    Hi everyone.
    I have a problem. I made a sample program to upload CSV file to server memory;iternal table i mean. if csv file has numeric and english data, it works well. but it's not work when i made a csv file with Korean. my code is below. how can i do??
    DATA: FILEUPLOAD TYPE REF TO CL_HTMLB_FILEUPLOAD.
    DATA: CONTENT_LENGTH TYPE STRING,
          FILE_CONTENT TYPE XSTRING ,
          FILE_LENGTH TYPE STRING ,
          FILE_MIME_TYPE TYPE STRING ,
          FILE_NAME TYPE STRING .
    DATA: CONTENT TYPE STRING.
    FILEUPLOAD ?= CL_HTMLB_MANAGER=>GET_DATA(
                           REQUEST = REQUEST
                           ID      = 'file1'
                           NAME    = 'fileUpload' ).
    FILE_NAME      = FILEUPLOAD->FILE_NAME.
    FILE_MIME_TYPE = FILEUPLOAD->FILE_CONTENT_TYPE.
    FILE_LENGTH    = FILEUPLOAD->FILE_LENGTH.
    FILE_CONTENT   = FILEUPLOAD->FILE_CONTENT.
    data: conv type ref to CL_ABAP_CONV_IN_CE .
    data: tmp type string.
    data: cnt type i.
        CONV = CL_ABAP_CONV_IN_CE=>CREATE( INPUT = FILE_CONTENT
                                           ENCODING = 'UTF-8' ).
        CONV->READ( EXPORTING N = cnt
                    IMPORTING DATA = CONTENT ).
        tmp = content.

    Hi,
    Pls check threads like
    File Download / Upload Question
    Eddy
    PS. Reward the useful answers and you will get <a href="http:///people/baris.buyuktanir2/blog/2007/04/04/point-for-points-reward-yourself">one point</a> yourself!

  • CSV File upload in SharePoint 2013

    Hi,
    We need to upload the CSV file in document library and need to call the java service in the event receiver and read the uploaded CSV file content and parse it as JSON and pass to the java service. 
    Is there anyway we can compare the already uploaded file content with same file name user trying to upload again with the same content . In case if user changed the some content and trying to upload again, we nee to identify whether the file is really updated
    the content or not. This will avoid the unnecessary java service call. Please let me know the suggestion.
    Thank you,
    Mylamy

    there is no method or properties to compare files.We have do row by row
    using power shell we can do it
    http://blogs.technet.com/b/stefan_stranger/archive/2011/02/08/compare-two-different-csv-files-using-powershell.aspx
    http://social.technet.microsoft.com/Forums/scriptcenter/en-US/00ef8b0d-00d9-42fd-9b6a-c6de58b9bd00/using-powershell-to-compare-2-csv-files?forum=winserverpowershell
    other solutions
    http://stackoverflow.com/questions/5154370/compare-two-csv-file-using-in-c-sharp
    http://stackoverflow.com/questions/3458355/c-sharp-comparing-two-csv-files-and-giving-an-output

  • .CSV Files upload

    I have all my contacts in a web based database that can export .csv files. I want to upload this data to a fifth generation Ipod for contact management purposes.
    Does the ipod have a csv upload feature?
    How can do this?
    what is the easiest method? I would prefer not to upload to outlook b/f uploading to Ipod

    Welcome to Apple Discussions!
    Hm...Windows-formatted iPods take contacts from Outlook Express. Try taking your .csv files to Outlook for it to convert (I believe it will, however I'm not sure because I don't have it because I hate Outlook :P). If after Outlook takes your contacts, put your iPod into Disk Mode and when your plug your iPod in for synching with iTunes, you will see a folder that comes up with Contacts, Notes, and Calendar (the default name for the iPod drive is Drive F:, I believe). Take your contacts then from Outlook Express to your Contacts folder, that should work if all of the above goes smoothly.
    Be careful with Disk Mode though, it confuses a lot of people
    Hope this helps!
    rjl
    307

  • Schedule a CSV File upload?

    I have a requirement from a customer to upload a Exchance Rate Currency file into an Oracle 10g database table at a specific time every day. I can see how to upload the table, but I need to know if there is a way to schedule this to happen daily and if there are instructions on this process.
    I am using the utillity in Enterprise Manager to upload data from a CSV file.
    Thanks,
    Winston

    Thanks guys. I am actually running 10g on a Windows
    platform, so I can't follow the guidelines for that.
    HJ, can you expand a little on your suggestion? That
    doesn't mean anything to me. I'm fairly new to the
    Oracle DB.
    Thanks,
    WinstonOK, so write a batch file (to invoke sqlldr) and schedule it through the Windows scheduler. Same principal as writing a shell script and scheduling with cron.

  • .CSV File upload  program in CCM

    HI Gurus,
    Is there any possibility of calling file upload program from another program which should pick the file stored in server and upload as we do it in manually selecting the supplier and upload the .csv file by specifying the path.Kindly advice.
    Thanks and Regards,
    Sathya kumar.

    Hi
    I have not tried this.. But i guess it's possible.
    What's your detailed business requirement ?
    Do let me know.
    Regards
    - Atul

  • Help needed on CSV file uploading

    Hi All,
    I need to upload a csv file in the table through file browse button.For that i have created the below process and function.This method is working perfectly fine when the file size is small.But i need to upload the file of 16 MB size and when i try to upload that file it gives error wwv_flow.accept error.Any expert of APEX please help me out on this error.As i am very new to APEX and i need to get this done as early as possible.Please provide any solution ,i will be really grateful to the person.
    function
    create or replace function hex_to_decimal
    --this function is based on one by Connor McDonald
    --http://www.jlcomp.demon.co.uk/faq/base_convert.html
    ( p_hex_str in varchar2 ) return number
    is
    v_dec number;
    v_hex varchar2(16) := '0123456789ABCDEF';
    begin
    v_dec := 0;
    for indx in 1 .. length(p_hex_str)
    loop
    v_dec := v_dec * 16 + instr(v_hex,upper(substr(p_hex_str,indx,1)))-1;
    end loop;
    return v_dec;
    end hex_to_decimal;
    Process
    DECLARE
    v_blob_data BLOB;
    v_blob_len NUMBER;
    v_position NUMBER;
    v_clob_data CLOB := 'anything';
    dest_offset NUMBER := 1;
    src_offset NUMBER := 1;
    blob_csid NUMBER := dbms_lob.default_csid;
    lang_ctx INTEGER := dbms_lob.default_lang_ctx;
    warning INTEGER;
    v_raw_chunk RAW(10000);
    v_char CHAR(1);
    c_chunk_len number := 1;
    v_line VARCHAR2 (32767) := NULL;
    v_data_array wwv_flow_global.vc_arr2;
    v_rows number;
    v_sr_no number := 1;
    BEGIN
    delete from scg_recievables2;
    -- Read data from wwv_flow_files
    select blob_content into v_blob_data
    from wwv_flow_files
    where last_updated = (select max(last_updated) from wwv_flow_files where UPDATED_BY = :APP_USER)
    and id = (select max(id) from wwv_flow_files where updated_by = :APP_USER);
    v_blob_len := dbms_lob.getlength(v_blob_data);
    v_position := 1;
    -- Read and convert binary to char
    WHILE ( v_position <= v_blob_len ) LOOP
    dbms_lob.converttoclob(v_clob_data, v_blob_data, v_blob_len, dest_offset,src_offset,blob_csid,lang_ctx,warning);
    v_char := dbms_lob.getlength(v_clob_data);
    v_line := v_line || v_char;
    v_position := v_position + c_chunk_len;
    -- When a whole line is retrieved </span>
    IF v_char = CHR(10) THEN
    -- Convert comma to : to use wwv_flow_utilities
    v_line := REPLACE (v_line, ';', ':');
    -- Convert each column separated by : into array of data
    v_data_array := wwv_flow_utilities.string_to_table (v_line);
    if IsNumber(substr(v_data_array(9),1,1)) = 1 then
    v_data_array(9) := substr(v_data_array(9),1,11);
    else
    v_data_array(9) := '01-JAN-1900';
    end if;
    v_data_array(9) := NVL(v_data_array(9),'01-JAN-1900');
    -- Insert data into target table
    EXECUTE IMMEDIATE 'insert into scg_recievables2 (Account_receivable_number, the_account_number, bill_history_tran, service_number, item_type, the_amount_billed, the_remaining_amount,source_of_payment)
    values (:1,:2,:3,:4,:5,:6,:7,:8,:9)'
    USING
    v_data_array(1),
    v_data_array(2),
    v_data_array(3),
    v_data_array(4),
    v_data_array(5),
    v_data_array(6),
    v_data_array(7),
    v_data_array(8);
    -- Clear out
    v_line := NULL;
    v_sr_no := v_sr_no + 1;
    END IF;
    END LOOP;
    END;

    You are probably timing out with your web server. Check the server logs to see if there are any errors there..
    Thank you,
    Tony Miller
    Webster, TX
    A lady came up to me on the street, pointed at my suede jacket and said "Do you know a cow was murdered to make that jacket?"
    "I didn't know there were any witnesses", I replied " Now I'll have to kill you too"

  • Please help me analysis it, Failed when CSV file upload to PSA,

    我的步骤是先建
    1.DATASOURCE;
    2.填写EXTACTION TAB的信息, 数据格式旋转CSV,数据分割输入代号u201D,u201C
    3.在Proposal tab,点击加载数据,可以看到CSV里面的数据;
    4,点击Fields Tab,就跳出对话框u201CField list no longer corresponds to default copy changesu201D "yes or no "
    5.点击YES,在FIields tab 里面可以看到Field,desciption等信息
    6.点击PREVIEW,就出现错误信息,
    请大家帮忙分析一下错误原因在那里。
    ---Runtime error -description of exception;
    Runtime errors Data_length_negative
    Except. CX_XY_RANGE_OUT_OF_BOUNDS
    short text Invailid partial field access :length negative
    what happened Errpr in the ABAP application program
    The current Abap program "CL_RSAR_PSA==============CP " has to be terminated bacause it has
    come across a statement that unfortunately can't be executed.
    Error analysis
    An exception occured that is explained in detail below.
    The exception,which is assigned to calss 'CX_SY_RANGE_OUT_OF_BOUNDS", was not caught in
    Procedure "_GET_DDI_STRUCTURE" "METHOD)",nor was it propagated by a raising clause.
    since the caller of the produre "method"...........

    只有一行数据也还是报同样的错,
    我刚刚开始学,不知道怎么DEBUG,能否简单说一下怎么DEBUG嘛?
    谢谢。
    ----下面是错误信息
    Runtime Errors         DATA_LENGTH_NEGATIVE
    Except.                CX_SY_RANGE_OUT_OF_BOUNDS
    Date and Time          09/04/2009 21:34:14
    Short text
    Invalid partial field access: Length negative
    What happened?
    Error in the ABAP Application Program
    The current ABAP program "CL_RSAR_PSA===================CP" had to be
    terminated because it has
    come across a statement that unfortunately cannot be executed.
    What can you do?
    Note down which actions and inputs caused the error.
    To process the problem further, contact you SAP system
    administrator.
    Using Transaction ST22 for ABAP Dump Analysis, you can look
    at and manage termination messages, and you can also
    keep them for a long time.
    Error analysis
    An exception occurred that is explained in detail below.
    The exception, which is assigned to class 'CX_SY_RANGE_OUT_OF_BOUNDS', was not
    caught in
    procedure "_GET_DDIC_STRUCTURE" "(METHOD)", nor was it propagated by a RAISING
    clause.
    Since the caller of the procedure could not have anticipated that the
    exception would occur, the current program is terminated.
    The reason for the exception is:
    In the executed program "CL_RSAR_PSA===================CP", the system
    attempted to access the field
    "ME->P_PSA_TECHNAME" using the length "-3".
    However, a partial field access with a negative length specification is
    not allowed.
    How to correct the error
    Use a positive length specification if a part of the field "ME->P_PSA_TECHNAME"
    is to be
    accessed.
    If the error occurred in your own ABAP program or in an SAP
    program you modified, try to remove the error.
    If the error occures in a non-modified SAP program, you may be able to
    find an interim solution in an SAP Note.
    If you have access to SAP Notes, carry out a search with the following
    keywords:
    "DATA_LENGTH_NEGATIVE" "CX_SY_RANGE_OUT_OF_BOUNDS"
    "CL_RSAR_PSA===================CP" or "CL_RSAR_PSA===================CM00A"
    "_GET_DDIC_STRUCTURE"
    If you cannot solve the problem yourself and want to send an error
    notification to SAP, include the following information:
    1. The description of the current problem (short dump)
    To save the description, choose "System->List->Save->Local File
    (Unconverted)".
    2. Corresponding system log
    Display the system log by calling transaction SM21.
    Restrict the time interval to 10 minutes before and five minutes
    after the short dump. Then choose "System->List->Save->Local File
    (Unconverted)".
    3. If the problem occurs in a problem of your own or a modified SAP
    program: The source code of the program
    In the editor, choose "Utilities->More
    Utilities->Upload/Download->Download".
    4. Details about the conditions under which the error occurred or which
    actions and input led to the error.
    The exception must either be prevented, caught within proedure
    "_GET_DDIC_STRUCTURE" "(METHOD)", or its possible occurrence must be declared
    in the
    RAISING clause of the procedure.
    To prevent the exception, note the following:

  • User csv file upload

    Hi Guys,
    How would you perform a user csv upload?
    I know how to do it with Data Load, but how would you perform a user upload?
    P.

    Hi,
    Here is one solution
    http://avdeo.com/2008/05/21/uploading-excel-sheet-using-oracle-application-express-apex/
    Br,Jari

  • Reg. csv file upload

    Hi,
    In my source file i have a single product name as "a,b". But when i try to upload, it is not happening and throwing error.
    Please can anyone help me?
    Thanks,
    Madhu

    Hello,
    Take a look at the 'Optionally Enclosed By' option when you upload your file, since your text contains a comma you might want to enclose the strings by quotation marks and then use the Optionally Enclosed By to allow APEX to parse each string individually.
    Hope this helps,
    John.
    Blog: http://jes.blogs.shellprompt.net
    Work: http://www.apex-evangelists.com
    Author of Pro Application Express: http://tinyurl.com/3gu7cd

  • CSV file upload problem

    Hi All,
    We are trying to upload files with size 6 GB. If files are split into smaller size it can increase file size which is not acceptable to implementer.
    We tried to upload this file from our local system but we are getting memory error.
    I want to know has any one tried this size upload and how did you try the same.
    Regards
    Rahul

    Hi,
    Loading such a huge file from the local machine (thru Foreground) is never advisable. As most of the time, foreground process run for a very short duration of time which is not enough to load such huge file.
    The only option remains is to split the file into manageable chunksu2019 and load it thru foreground or use background process to load the 6 GB file. (Loading from background means you need to move this file to application server.
    Regards,
    Yogesh.

  • Request: Ability to update metadata via spreadsheet view or csv file upload

    A fairly simple change to make Muse more efficient and user-friendly.
    I'm in the process of building out a medium size site for a client (90+ pages) - my first experience using Muse - and editing metadata is a pain. I've planned the site: page titles, descriptions, page names, etc, but updating metadata isn't the first step in my creation process and now I'm going back through updating information. My have a 2013 Mac Pro and 2013 Macbook Pro and both systems take time to update this information with so much data buffering and being updated.
    My request:
    The ability to update metadata across a site without the changes being executed until we applied the changes. For example, changing site view to a spreadsheet view with each pages information. Then, I could update a bunch of pages and hit enter, and walk away while it takes 5 minutes to update. This would also eliminate the hassle of requesting page properties from each page separately.
    Thanks in advance.

    Is your DTP full or delta.
    Here is some interesting discussion.
    /thread/348238 [original link is broken]

Maybe you are looking for