Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Uploaded file needs the user ID in the file name

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Uploaded file needs the user ID in the file name

    I have a web app in version 11 which allows users to upload a file. Since the application is multi-agency and multi-user, I would like the file to either include the user ID, agency name, or both. My concern is an agency MAY have users with the same name, so I need to use the user ID, which will not change. So how can I make it accept the user ID and not allow that to not be included in the file name?

    -JR
    J.R.
    Epigate Software, LLC.

    [email protected]
    http://www.epigate.com
    sigpic

    #2
    Re: Uploaded file needs the user ID in the file name

    I don't know the answer, but it sounds like you and I have similar applications. One of mine is a multi-agency/multi-user Police Records Management app, and the other is the same for Fire/EMS LOSAP-RMS records. And like you, I have file/photo upload sections. Presently my uploaded files do not contain any identifier that links them to the user that uploaded them, but I'd like them too.

    If/when you figure this out, you'll be doing both of us a favor!!

    Rich
    Attached Files
    Sergeant Richard Hartnett
    Hyattsville City Police Department
    Maryland

    Comment


      #3
      Re: Uploaded file needs the user ID in the file name

      Originally posted by J.R. Noe View Post
      I have a web app in version 11 which allows users to upload a file. Since the application is multi-agency and multi-user, I would like the file to either include the user ID, agency name, or both. My concern is an agency MAY have users with the same name, so I need to use the user ID, which will not change. So how can I make it accept the user ID and not allow that to not be included in the file name?

      -JR
      Why should any of these dataelements be in the name of the file?
      What do you mean with name of the file?

      If name of the file is some unique identifier then why should that include a userid?

      What I am trying to say is. Suppose you have a reference table through wchich you find files. Then in that reference table you put all the fields that you need.
      Id is something that the application uses and is unique. The user cannot influence this.
      Name is what the user sees and that can be the same for different files.
      Userid would be another field in that table to know who 'owns'it.
      etc.

      hth

      Pieter

      Comment


        #4
        Re: Uploaded file needs the user ID in the file name

        Pieter, it is a little confusing, but I think we are talking apples and oranges. I understand what you are saying and it makes sense, but it is not what is the issue at hand. What Richard and I am talking about is the actual file that is uploaded. If 2,000 users are uploading an electronic CPR card, chances are some cards will be saved using the same file name and overwrite another file. Setting it to not overwrite is not acceptable for this option.
        But, if the user id could be included automatically with each file upload, then every user could use the same file name and not overwrite another users file.
        So instead of "C:\\UploadedFiles\MyCPR.txt" it would be "C:\\UploadedFiles\MyCPR_1592.txt" with 1592 being the user id.
        J.R.
        Epigate Software, LLC.

        [email protected]
        http://www.epigate.com
        sigpic

        Comment


          #5
          Re: Uploaded file needs the user ID in the file name

          Pieter, it is a little confusing, but I think we are talking apples and oranges. I understand what you are saying and it makes sense, but it is not what is the issue at hand. What Richard and I am talking about is the actual file that is uploaded. If 2,000 users are uploading an electronic CPR card, chances are some cards will be saved using the same file name and overwrite another file. Setting it to not overwrite is not acceptable for this option.
          But, if the user id could be included automatically with each file upload, then every user could use the same file name and not overwrite another users file.
          So instead of "C:\\UploadedFiles\MyCPR.txt" it would be "C:\\UploadedFiles\MyCPR_1592.txt" with 1592 being the user id.
          J.R.
          Epigate Software, LLC.

          [email protected]
          http://www.epigate.com
          sigpic

          Comment


            #6
            Re: Uploaded file needs the user ID in the file name

            No idea how I managed to post that twice. Can one be deleted?
            J.R.
            Epigate Software, LLC.

            [email protected]
            http://www.epigate.com
            sigpic

            Comment


              #7
              Re: Uploaded file needs the user ID in the file name

              I assume you are storing a reference to the file in the database and the file itself in some directory.
              How do I keep them unique.
              1. the database table has an autoincrement nummer ( For you user_id , which is not unique)
              2. Add the name of the user to the name for me 12.mycpr.txt for you 1592.mycpr.txt
              3. Oeps this name already exists. ad date and time to the name 12.mycpt.20131014070245.txt , for you 1592.mycpt.20131014070245.txt
              4. do this in a loop as long as the name exists you repeat the procedure. So the name gets longer if it is to long give an error.

              I have the xbasic not at hand here I'll send what i have later if something like this is what u want.

              pieter

              Comment


                #8
                Re: Uploaded file needs the user ID in the file name

                Thank you Pieter. I will try anything at this point. I have exhausted all my ideas and attempts. Send me what you have and I will give it a try.

                Thanks,
                -JR
                J.R.
                Epigate Software, LLC.

                [email protected]
                http://www.epigate.com
                sigpic

                Comment


                  #9
                  Re: Uploaded file needs the user ID in the file name

                  Ok hope you can find what you need from it :
                  I use the file-upload user defined action and I call dofileupload
                  Of course I am not clever enough to come up with all of this so I got most of it from:
                  http://news.alphasoftware.com/V10Pre...ileUpload.html


                  start xbasic
                  =============================
                  function doFileUpload as v (e as p)
                  'This function is called after the file(s) selected in the Upload Files dialog have been uploaded to the server.
                  'The function is responsible for processing each uploaded file.

                  'Request - The Request object. Includes Request.Variables, which should be used instead of the older e.rv construct
                  'Session - The Session object. Should be used instead of the older e.session construct

                  'The passed in 'e' object contains these properties

                  'e.fileCount - the number of files that were uploaded
                  'e.fileArray - a property array with one entry for each uploaded file
                  'e.uploadProperties - Contains multiple sub-properties for all of the properties set in the Action builder.
                  'e.tmpl - pointer to the Grid definition
                  'e.rtc - a pointer variable that contains run-time calculations
                  'e.__si - state information
                  'e.rowNumber - row number of the Grid row that has focus. If val(e.rowNumber) < 0, then it is a new record row.
                  'e.part - either 'G' (for 'Grid') or 'D' (for 'DetailView'). Test left(e.part,1) = "D" .or left(e.part,1) = "G"
                  'e.primaryKeyArray - an array of primary key values for the current row's primary key. If the primary key is based on a single field (or record number in the case of a .dbf table), the array will have one entry. If the primary key comprises multiple columns, the array will have an entry for each column in the primary key.

                  'e._isLinkedGrid - .t. if the Grid is a linked Grid (i.e. it has a parent Grid)
                  'e._linkValues = linking value. Contains a CRLF delimited list of linking values in this format: fieldname|type|linkingValue


                  'Each entry in the e.fileArray array has these propeties (where 'i' is between 1 and e.fileCount):
                  'e.fileArray[1].file.characterSet - character set of the uploaded file
                  'e.fileArray[1].file.contentType - MIME type (e.g. 'application/octet-stream')
                  'e.fileArray[1].data - data that was uploaded. This will either be binary data or text data. Check the .file.dataType property
                  'e.fileArray[1].fileName - filename of the file on the client machine
                  'e.fileArray[1].encoding - For text files, specifies the encoding type
                  'e.fileArray[1].file.dataType = Either 'text' or 'binary'

                  'If you want to send any Javascript back to the browser to execute after this event has completed, you can set this property:
                  'e.javascript
                  'EXTREMELY IMPORTANT - The Javascript that is sent back to the browser is executed in the context of the IFrame that contains the File Select window.
                  'Therefore, in order for the Javascript you send back to invoke methods of the Grid object, you must prefix all methods with 'window.parent'.
                  'For example: window.parent.{grid.object}.refresh()

                  'You can set e.abort = .t. to abort the operation. If you set e.abort to .t. then you can set e.errorText to the text you want to display to the user.
                  'e.abort = .t.
                  'e.errorText = "test "


                  'check if default directory exists if not create it
                  dim strdir as c
                  strdir = filename_decode("[PathAlias.Documents]")
                  dim flag as l
                  flag = A5_IS_PATH_VALID(strdir)
                  if flag = .f. then
                  dir_create(strdir)
                  end if
                  strdir = strdir + chr(92) +session.__protected__lic_CustomerCode
                  flag = A5_IS_PATH_VALID(strdir)
                  if flag = .f. then
                  dir_create(strdir)
                  end if
                  strdir = strdir + chr(92) + "documents"
                  flag = A5_IS_PATH_VALID(strdir)
                  if flag = .f. then
                  dir_create(strdir)
                  end if
                  flag = A5_IS_PATH_VALID(strdir)
                  if flag = .f. then
                  e.abort = .t.
                  e.errorText = "Fatal error Directory could not be created: "+strdir
                  exit function
                  end if



                  dim count as n

                  'get a count of the number of files that were uploaded
                  ' until now it will be only one.
                  count = e.filecount
                  dim i as n
                  dim arr as p

                  'get the array that contains all of the uploaded files
                  arr = e.filearray
                  dim cn as sql::connection
                  dim cs as c
                  'cs = e.tmpl.cs.connectionstring
                  'cn.open(cs)
                  flag = a5SQLConnectionOpen(cn,"::name::dataPieterOntwikkeling", session)
                  if flag = .f. then
                  dim msg as c
                  msg = "Could not connect to database. Error reported was: " + cn.CallResult.text
                  'we need to encode this for javascript since the message will be sent back to the browser for display
                  'js_escape() encodes ' as \' and crlf as \n
                  msg = js_escape(msg)
                  dim jscmd as c
                  jscmd = "alert('" + msg + "');"
                  dofileupload = jscmd
                  exit function
                  end if


                  dim strsql as c
                  'We have the key to check if it is a new upload or a replacement
                  'construct the sql statement to get information from the record
                  strsql = <<%sql%
                  select doculink.docentity, doculink.DocuFile_nummer, docufile.DocuFileDirectory, docufile.DocufileBestand, docufile.DocufileBestandOpgeslagen
                  from doculink left join docufile on docufile.DocuFile_nummer = doculink.DocuFile_nummer where doculink.DocuLink_Nummer = :whatdoculink_nummer;
                  %sql%

                  'create a sql arguments object
                  dim args as sql::arguments
                  args.add("whatdoculink_nummer",convert_type(e.primaryKeyArray[1],"N"))

                  flag = cn.execute(strsql, args)

                  if flag = .f. then
                  'there was an error - close the connection and exit
                  cn.Close()
                  dim msg as c
                  msg = "Could not get doculink file info. Error reported was: " + cn.CallResult.text
                  msg = js_escape(msg)
                  dim jscmd as c
                  jscmd = "alert('" + msg + "');"
                  dofileUpload = jscmd
                  exit function
                  end if
                  dim rs as sql::ResultSet
                  rs = cn.ResultSet
                  dim fn as c
                  dim data as b
                  'get the binary data that was uploaded
                  data = e.fileArray[1].data


                  dim filenametemp as c
                  dim lidocufile_nummer as n

                  if rs.data(2) > 0 then
                  lidocufile_nummer = rs.data(2)
                  'Existing file has to be overwritten
                  e.javascript = "alert('Fatal error');"
                  'check if directory exists if not use standaard which is strdir variable
                  dim strdirspec as c
                  strdirorg = rs.data(3)
                  flag = A5_IS_PATH_VALID(strdirorg)
                  if flag = .f. then 1 = 1
                  else 'we use the original directory
                  strdir = strdirorg
                  'rename existing file'
                  dim filenameorg as c
                  filenameorg = rs.data(5)
                  dim filenameorgrename as c
                  filenameorgrename = strdir + chr(92) + dtoc(now()) + time("0h_0m_0s",now())+ "_546_" + filenameorg
                  filenameorg = strdir + chr(92) + filenameorg
                  file.rename(filenameorg, filenameorgrename)
                  end if

                  ' save the uploaded file to the new name
                  ' construct a new name
                  'New file name is string(lidocufile_nummer)+.+filenaam
                  'check if it exists if yes dan try string(lidocufile_nummer)+.+now()+.+filenaam
                  filenametemp = alltrim(str(liDocufile_nummer) + "." + e.fileArray[1].fileName)
                  'construct a filename. this is a server side filename.
                  fn = strdir + chr(92) + filenametemp
                  flag = file.exists(fn)
                  if flag = .t. then 'try alternative
                  filenametemp = alltrim(str(liDocufile_nummer) + "." + dtoc(now())+ time("0h_0m_0s",now())+ "_549_" + "." + e.fileArray[1].fileName)
                  fn = strdir + chr(92) + filenametemp
                  if flag = .t. then 'oeps
                  'rename original file back
                  file.rename(filenameorgrename, filenameorg)
                  dim msg as c
                  msg = "File already exists record cannot be changed. Error reported was: " + cn.CallResult.text
                  cn.Close()
                  msg = js_escape(msg)
                  e.abort = .t.
                  e.errorText = msg
                  exit function
                  end if
                  end if
                  'Save file and edit record
                  'get the binary data that was uploaded
                  dim data as b
                  data = e.fileArray[1].data
                  'save the binary data to a file
                  file.From_blob(fn,data)
                  args.add("whatdirectory",strdir)
                  args.add("whatfilenameorg", e.fileArray[1].filename)
                  args.add("whatfilename",filenametemp)
                  args.add("whatuser", session.username)
                  args.add("whatdate", date_format(date(), "yyyy-MM-dd"))
                  args.add("whatdocufile_nummer",lidocufile_nummer)

                  strsql = <<%sql%
                  update docufile set docufiledirectory = :whatdirectory, docufilebestand = :whatfilenameorg,
                  docufileBestandOpgeslagen = :whatfilename
                  , Docufiledatum = :whatdate, mutatiedoor = :whatuser where docufile_nummer = :whatdocufile_nummer;
                  %sql%
                  flag = cn.execute(strsql, args)
                  if flag = .f. then
                  'there was an error - close the connection and exit
                  dim msg as c
                  msg = "Could not update inserted record in docufile. Error reported was: " + cn.CallResult.text
                  cn.Close()
                  msg = js_escape(msg)
                  e.abort = .t.
                  e.errorText = msg
                  exit function
                  end if
                  'delete the original file
                  file.remove(filenameorgrename)


                  else
                  ' create new record in docufile to get the key of the file
                  ' save the uploaded file to the new name
                  ' edit the record in docufile with the new name

                  fn = strdir + chr(92) + e.fileArray[1].fileName
                  filenametemp = dtoc(now()) + time("0h_0m_0s",now())+ "_546_" + e.fileArray[1].filename
                  args.add("whatdirectory",strdir)
                  args.add("whatfilename",filenametemp)
                  args.add("whatuser", session.username)
                  args.add("whatdate", date_format(date(), "yyyy-MM-dd"))

                  strsql = <<%sql%
                  insert into docufile (Docufile.docufiledirectory, Docufile.Docufilebestand, docufile.Docufilebestandopgeslagen, Docufiledatum, mutatiedoor )
                  values (:whatdirectory, :whatfilename, :whatfilename, :whatdate, :whatuser);
                  %sql%
                  flag = cn.execute(strsql, args)

                  if flag = .f. then
                  'there was an error - close the connection and exit
                  dim msg as c
                  msg = "Could not insert record in docufile. Error reported was: " + cn.CallResult.text
                  msg = js_escape(msg)
                  e.abort = .t.
                  e.errorText = msg
                  cn.close()
                  exit function
                  end if
                  'get the inserted key
                  dim lidocufile_nummer as n
                  strsql = <<%sql%
                  SELECT LAST_INSERT_ID();
                  %sql%
                  flag = cn.execute(strsql, args)
                  if flag = .f. then
                  'there was an error - close the connection and exit
                  dim msg as c
                  msg = "Could not get key inserted record in docufile. Error reported was: " + cn.CallResult.text
                  cn.Close()
                  msg = js_escape(msg)
                  e.abort = .t.
                  e.errorText = msg
                  exit function
                  end if
                  rs = cn.ResultSet
                  liDocufile_nummer = rs.data(1)
                  args.add("whatdocufile_nummer", liDocufile_nummer)
                  'New file name is string(lidocufile_nummer)+.+filenaam
                  'check if it exists if yes dan try string(lidocufile_nummer)+.+now()+.+filenaam
                  filenametemp = alltrim(str(liDocufile_nummer) + "." + e.fileArray[1].fileName)
                  'construct a filename. this is a server side filename.
                  fn = strdir + chr(92) + filenametemp
                  flag = file.exists(fn)
                  if flag = .t. then 'try alternative
                  filenametemp = alltrim(str(liDocufile_nummer) + "." + dtoc(now()) + "." + e.fileArray[1].fileName)
                  fn = strdir + chr(92) + filenametemp
                  if flag = .t. then 'oeps
                  strsql = <<%sql%
                  delete from docufile where docufile_nummer = :whatdocufile_nummer;
                  %sql%
                  flag = cn.execute(strsql, args)
                  dim msg as c
                  msg = "File already exists new record cannot be added. Error reported was: " + cn.CallResult.text
                  cn.Close()
                  msg = js_escape(msg)
                  e.abort = .t.
                  e.errorText = msg
                  exit function
                  end if
                  end if
                  'Save file and edit record
                  'get the binary data that was uploaded
                  dim data as b
                  data = e.fileArray[1].data
                  'save the binary data to a file
                  file.From_blob(fn,data)
                  args.add("whatdirectory",strdir)
                  args.add("whatfilenameorg", e.fileArray[1].filename)
                  args.add("whatfilename",filenametemp)
                  strsql = <<%sql%
                  update docufile set docufiledirectory = :whatdirectory, docufilebestand = :whatfilenameorg,
                  docufileBestandOpgeslagen = :whatfilename where docufile_nummer = :whatdocufile_nummer;
                  %sql%
                  flag = cn.execute(strsql, args)
                  if flag = .f. then
                  'there was an error - close the connection and exit
                  dim msg as c
                  msg = "Could not update inserted record in docufile. Error reported was: " + cn.CallResult.text
                  cn.Close()
                  msg = js_escape(msg)
                  e.abort = .t.
                  e.errorText = msg
                  exit function
                  end if
                  'update doculink record met het docufile_nummer
                  strsql = <<%sql%
                  update doculink set docufile_nummer = :whatdocufile_nummer where doculink_nummer = :whatdoculink_nummer;
                  %sql%
                  flag = cn.execute(strsql, args)
                  if flag = .f. then
                  'there was an error - close the connection and exit
                  dim msg as c
                  msg = "Could not update inserted record in docufile. Error reported was: " + cn.CallResult.text
                  cn.Close()
                  msg = js_escape(msg)
                  e.abort = .t.
                  e.errorText = msg
                  exit function
                  end if
                  cn.close()
                  'Resultaat wegschrijven naar een txt bestand
                  'filename = "c:\temp\output4.txt"
                  'file_pointer = file.create(filename, FILE_RW_EXCLUSIVE)
                  'file_pointer.write("4")
                  'file_pointer.flush()
                  'file_pointer.close()

                  end if

                  end function


                  =============================
                  end xbasic

                  hth

                  Pieter

                  Comment


                    #10
                    Re: Uploaded file needs the user ID in the file name

                    Pieter, in my case, I would like the linkingkey to be a part of the document's file name.

                    That way, as J.R. said, if any of the uploaded documents (photos for example) should somehow get separated from their database reference field, it would be easy to see where they belong.

                    So ideally, I would like a photo name to be something like "C12345-10122013190231.jpg" Where "C12345" is the linkingkey, and the rest is the date/time stamp which makes the file name unique.

                    I couldn't find any option in the File or Photo Upload Feature Pack that would allow the file name to include any reference from the table it is linked to.
                    Sergeant Richard Hartnett
                    Hyattsville City Police Department
                    Maryland

                    Comment


                      #11
                      Re: Uploaded file needs the user ID in the file name

                      Originally posted by Rich Hartnett View Post
                      Pieter, in my case, I would like the linkingkey to be a part of the document's file name.

                      That way, as J.R. said, if any of the uploaded documents (photos for example) should somehow get separated from their database reference field, it would be easy to see where they belong.

                      So ideally, I would like a photo name to be something like "C12345-10122013190231.jpg" Where "C12345" is the linkingkey, and the rest is the date/time stamp which makes the file name unique.

                      I couldn't find any option in the File or Photo Upload Feature Pack that would allow the file name to include any reference from the table it is linked to.
                      Richard,
                      That is what i do each NEW file is saved starting with the number of (meaningless) id of the reference table.
                      After the else is the code to save a new file. As this is a mysql database with an autoincrement key I first save the record in the database and then change the name of the uploaded file to include the key.
                      Then change the record again to include the correct filename after saving the uploaded file.

                      "rs = cn.ResultSet
                      liDocufile_nummer = rs.data(1)
                      args.add("whatdocufile_nummer", liDocufile_nummer)
                      'New file name is string(lidocufile_nummer)+.+filenaam"

                      liDocufile_nummer is the id from the reference table so something like 123456 then I put this plus a dot in front of the filename to construct the name of the file as it is saved.
                      So the file 123456.Invoice7654.pdf is found in the reference table with id 123456

                      Pieter

                      Comment


                        #12
                        Re: Uploaded file needs the user ID in the file name

                        Hmmm, well that might be the difference with my setup. I am not creating a new record for each uploaded document or photo, as I have fields reserved in the incident data table specifically for that purpose. (This of course limits the number of documents/photos that can be uploaded to each incident, but I actually wanted it that way.) So in other words, a record has already been created, and the user is uploading files that go with that record. There is no separate reference table being used.
                        Sergeant Richard Hartnett
                        Hyattsville City Police Department
                        Maryland

                        Comment


                          #13
                          Re: Uploaded file needs the user ID in the file name

                          So. What stops you from adding the key of that record in front of the uploaded filename?
                          That is what I do when a file is replaced. Suppose the record id is 123456 and the record has a filename of 123456.invoice7654.pdf.
                          The user uploads a filename invoice89578.pdf the system will save the file 123456.invoice89578.pdf and the other file is removed.

                          "if rs.data(2) > 0 then
                          lidocufile_nummer = rs.data(2)
                          'Existing file has to be overwritten"



                          if you have say 5 files per record you can come up with some contruct in the file name to identify the position in the record.
                          123456.1.blabla.txt is the first file in record 123456
                          123456.2.xyyd.pdf is the second file etc.

                          Comment

                          Working...
                          X