Multiple cffile upload issues

Hello all. I'm having a little issue with a multiple upload I
am trying to achieve. I've been searching and searching but could
not find an answer, and maybe you guys could help me. Well I'm
doing multiple uploads on a form i created and it's uploading the
file and file name correctly, but it's inserting 6 records
everytime I'm hitting the submit button. Also, I've notice in my
database is when you click the submit button, it's inserting the
same file in one record 6 times, then it creates a new record and
inserts the second file 6 times. I'm going to post the code here,
maybe it's something I'm missing, not sure. Thanks for the help.

dame.cranon wrote:
> Hello all. I'm having a little issue with a multiple
upload I am trying to
> achieve. I've been searching and searching but could not
find an answer, and
> maybe you guys could help me. Well I'm doing multiple
uploads on a form i
> created and it's uploading the file and file name
correctly, but it's inserting
> 6 records everytime I'm hitting the submit button. Also,
I've notice in my
> database is when you click the submit button, it's
inserting the same file in
> one record 6 times, then it creates a new record and
inserts the second file 6
> times. I'm going to post the code here, maybe it's
something I'm missing, not
> sure. Thanks for the help.
>
>
>
> <cfloop index="i" from="1" to="6">
>
> <cfif isDefined("form.upload")>
>
> <cffile action="upload"
> destination="D:\Hosting\streetzmag\dev\crush_images\"
> filefield="pic#i#"
> nameconflict="makeunique"
> result="cffile.pic#i#"
> accept="image/jpeg, image/pjpeg, image/gif" >
>
> <!--- Code for insert of information --->
> <cfquery datasource="mysqlcf_streetzmag"
name="uploaded">
> INSERT INTO Information(firstname,
> lastname,
> email,
> contact_info,
> nickname,
> recent_work,
> hair_color,
> eye_color,
> ethnicity,
> age,
> height,
> measurements,
> pic_1,
> pic_2,
> pic_3,
> pic_4,
> pic_5,
> pic_6
>
>
> )
> VALUES('#FORM.firstname#',
> '#FORM.lastname#',
> '#FORM.email#',
> '#FORM.contact#',
> '#FORM.nickname#',
> '#FORM.work#',
> '#FORM.hair#',
> '#FORM.eye#',
> '#FORM.ethnic#',
> #FORM.age#,
> '#FORM.height#',
> '#FORM.measurements#',
> <cfif isDefined("form.pic#i#") and
evaluate("form.pic#i#") NEQ "">
> <cfqueryparam
value="#CFFILE['pic'&i].SERVERFILE#" cfsqltype="cf_sql_varchar"
> />
> <cfelse>
> NULL
> </cfif>,
>
> <cfif isDefined("form.pic#i#") and
evaluate("form.pic#i#") NEQ "">
> <cfqueryparam
value="#CFFILE['pic'&i].SERVERFILE#" cfsqltype="cf_sql_varchar"
> />
> <cfelse>
> NULL
> </cfif>,
>
> <cfif isDefined("form.pic#i#") and
evaluate("form.pic#i#") NEQ "">
> <cfqueryparam
value="#CFFILE['pic'&i].SERVERFILE#" cfsqltype="cf_sql_varchar"
> />
> <cfelse>
> NULL
> </cfif>,
>
> <cfif isDefined("form.pic#i#") and
evaluate("form.pic#i#") NEQ "">
> <cfqueryparam
value="#CFFILE['pic'&i].SERVERFILE#" cfsqltype="cf_sql_varchar"
> />
> <cfelse>
> NULL
> </cfif>,
>
> <cfif isDefined("form.pic#i#") and
evaluate("form.pic#i#") NEQ "">
> <cfqueryparam
value="#CFFILE['pic'&i].SERVERFILE#" cfsqltype="cf_sql_varchar"
> />
> <cfelse>
> NULL
> </cfif>,
>
> <cfif isDefined("form.pic#i#") and
evaluate("form.pic#i#") NEQ "">
> <cfqueryparam
value="#CFFILE['pic'&i].SERVERFILE#" cfsqltype="cf_sql_varchar"
> />
> <cfelse>
> NULL
> </cfif>
>
> )
> </cfquery>
> </cfif>
> </cfloop>
>
of course it will do everything 6 times since you have your
whole code
wrapped with cfloop from 1 to 6... so the code execution will
happen 6
times... plus your synatx for inserting filenames inside your
query
makes it insert same file 6 times (since the code is inside
one same
cfloop)...
you should separate your code and wrap only the cffile part
in a cfloop:
<cfif isDefined("form.upload")>
<cfloop index="i" from="1" to="6">
<cfif len(trim(form.pic#i#)) gt 0>
<cffile action="upload"
destination="D:\Hosting\streetzmag\dev\crush_images\"
filefield="pic#i#"
nameconflict="makeunique"
result="uploadedpic_#i#"
accept="image/jpeg, image/pjpeg, image/gif" >
</cfif>
</cfloop>
<!--- Code for insert of information --->
<cfquery datasource="mysqlcf_streetzmag"
name="uploaded">
INSERT INTO Information
(firstname,
lastname,
email,
contact_info,
nickname,
recent_work,
hair_color,
eye_color,
ethnicity,
age,
height,
measurements,
pic_1,
pic_2,
pic_3,
pic_4,
pic_5,
pic_6)
VALUES('#FORM.firstname#',
'#FORM.lastname#',
'#FORM.email#',
'#FORM.contact#',
'#FORM.nickname#',
'#FORM.work#',
'#FORM.hair#',
'#FORM.eye#',
'#FORM.ethnic#',
#FORM.age#,
'#FORM.height#',
'#FORM.measurements#',
<cfloop from="1" to="6" index="x">
<cfif isdefined("uploadedpic_#x#")>
<cfqueryparam value="#evaluate('uploadedpic_' & x)#"
cfsqltype="cf_sql_varchar"/>
<cfelse>
NULL
</cfif>
<cfif x lt 6>,</cfif>
</cfloop>)
</cfquery>
</cfif>
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com

Similar Messages

  • Multiple file upload issues

    I'm trying to create a simple web form capable of uploading multiple image files. I've followed the instructions as per  July 12, 2012, " Customizing Web Forms", "Adding multiple file attachment fields to the web form" and everthying seems to indicate that's it working, however when I go to "related files under cases I only see one file. Any ideas?

    Yes, you'll find it here: http://www.pikassopets.com/order/upload

  • CF8.01 Large Files Upload issue

    We are having an issue with posting large files to the server
    through CFFile. Our server is running on Windows 2003 R2 SP2 with
    2GB of RAM. The average upload size is 800MB and we may run into
    multiple simultaneous uploads with the large file size. So, we have
    adjusted the "Maximum size of post data" to 2000 MB and "Request
    Throttle Memory" to 5000 MB in the ColdFusion admin setting to
    hopefully can allow up to 5 simultaneous uploads.
    However, when we tried to launch two 800MB uploads at the
    same time from different machines, only one upload can get through.
    The other one returned "Cannot connect to the server" error after a
    few minutes. No errors can be found in the W3C log and the
    ColdFusion logs (coldfusion-out.log and exception.log) but it is
    reported in the HTTPErr1.log with the following message:
    2008-04-18 08:16:11 204.13.x.x 3057 65.162.x.x 80 HTTP/1.1
    POST /testupload.cfm - 1899633270 Timer_EntityBody DefaultAppPool
    Can anyone shed some light of it? Thanks!

    quote:
    Originally posted by:
    Newsgroup User
    Don't forget that your web server (IIS, Apache, etc.) can
    have upload
    throttles as well.
    We did not throttle our IIS to limit the upload/download
    bandwidth.
    Is there a maximum limit for "Request Throttle Memory"
    setting? Can we set it over the available physical RAM size?

  • Can you move a 'Multiple Image Upload' button  into the 'Update Form'?

    I am able to creat and an Update form and an image upload using the "Update Form Wizard" tool and the "Multiple Image Upload" tool succesfully.
    <br />
    <br />The problem comes when I try to move the "UPLOAD" button inside the Update form. Right now it looks like this:
    <br />http://www.webritesolutions.com/Test/upload/now.JPG
    <br />
    <br />This is how I would like it to show:
    <br />http://www.webritesolutions.com/Test/upload/tryingto.JPG
    <br />
    <br />I want to "Upload" button to go next to the "Update record" button. When I do this I get a javascript error and the "Update record" button is disabled.
    <br />Here is the code of what I tried to do:
    <br />
    <br />
    <br />
    <br />
    <br />
    <table>
    <tr class="KT_buttons">
    <td>
    <?php<br />        // Multiple Upload Helper<br /> echo $muploadHelper->Execute();<br /> ?>
    </td>
    <td colspan="1">
    <input type="submit" name="KT_Update1" id="KT_Update1" value="Update record" />
    <br /></td>
    </tr>
    </table>
    <br />
    <br />Here is the Javascript error:
    <br />http://www.webritesolutions.com/Test/upload/error.JPG
    <br />
    <br />thanks for your help.

    A control can only appear once in the visual tree. So you have to remove it from the Grid before you can add it to the DockPanel.
    This code will move the Border element from the Grid to the DockPanel when you click the button:
    Private Sub Button_Click(sender As Object, e As RoutedEventArgs)
    Dim border = CType(LayoutRoot.FindName("myborder"), Border)
    LayoutRoot.Children.Remove(border)
    contain.Children.Add(border)
    End Sub
    <StackPanel>
    <Grid x:Name="LayoutRoot">
    <Border x:Name="myborder" BorderBrush="Black" BorderThickness="2">
    <TextBlock>...</TextBlock>
    </Border>
    </Grid>
    <DockPanel x:Name="contain" Background="Yellow">
    <TextBlock>2</TextBlock>
    </DockPanel>
    <Button Click="Button_Click" Content="Move"/>
    </StackPanel>
    You can try it for yourself. But please post your code as formatted text and not as embedded images if you want anyone to be able to reproduce your issue and help you in the future.
    Please remember to close your threads by marking helpful posts as answer.

  • Multiple image upload CRASH!!! but works with simple image upload

    I'm getting MAD.
    I'm using php and GD
    While the simple image and re size works like a charm, the multiple image upload or the multiple file upload have a strange behavior.
    It opens the pop-up with flash, then eventually shows me files or thumbnails but when I try to up load I just wait and get the typical "system becoming unstable" flash error.
    As I can see the directory is always generated (I've tried also to put a static directory) but after stargin the upload the flash uploader just crashes and no result.
    Any help would be really appreciated

    Hi Fonzie,
    as the folder is getting created, the issue you´re having is not related to wrong folder permission - it´s something else...
    As I wrote before, che common upload and resize function works perfectly
    this one works perfectly, because it´s just one file to upload and to process, wheras doing that with multiple files might collide with some settings on your server
    So for sure it's not a simple issue as the max filesize
    Are you sure ? Did you check the current "max_upload_filesize" setting ? As long you don´t check it, you can´t know :-)
    As a general rule of thumb, it´s important to be aware of the fact that uploading & resizing images on the server might collide with several PHP settings -- and the more images you upload and resize in one swoop, the closer you´re getting to these limits respectively might even be exceeding them. The following "directives" are those which have an effect on whether your image/file upload & processing will work or not:
    - "max_upload_filesize" :: is sometimes set to just 8 MB on a shared hosting, sometimes 16 MB, sometimes more. This setting will affect the file upload procedure only
    - "set_time_limit" (e.g. 30 seconds) :: if the execution time of a script exceeds this limit for whatever reason, the server simply shuts it down without letting you (respectively the flash uploader) know it´s been shut down. This *might* be the reason why ADDT´s flash uploader hangs respectively returns that error message after some time, because it´s waiting for some response from the server which never comes.
    - "memory_limit" (e.g. 8 MB) :: this directive is a sort of "allocated server RAM" for your account, and it´s in particular the image resizing process which will grab more or less memory resources -- the higher the the resizing factor is, the more RAM is spent, and the more images are getting resized in one swoop, the worser it gets.
    However, all these PHP directives can be changed, and your host might even be so courteous to increase the currently defined values of those abovementioned directives for you -- and that´s what I´m suggesting at this point.
    Cheers
    Günter Schenk
    Adobe Community Expert, Dreamweaver

  • Multiple image upload with save to database problem

    I am developing some backend work for a client, and we recently used the Multiple image upload with save to database wizard without a problem. A few days later, we noticed that we could only upload a single file at a time - it seems that the coding is no longer able to access the flash part of this and is using the javasript function instead. I know the web hosting company has made some changes on the server, and I did some reearch and it seems that  there could be an issue with Flash 10, but has anyone else experienced anything like this? Any help is greatly appreciated.
    Thanks.
    Jeremy

    Thank you for the responses. I have already updated awhile ago, so I am wondering what happened. Not sure if during the server update, some files were replaced (unless I totally forgot to update to 1.0.1 on this site). So I reinstalled 1.0.1, deleted the includes folder from the server and uploaded my includes folder and it now works again.
    Again, thanks for the help.
    Jeremy

  • Multiple image uploads on a single page

    Hi
    I've created a small cms page where a user can upload images to specific image containers. Unfortunately the multiple image upload with db wizard won't allow more that one occurence per page.
    Any ideas to work around this will be greatly appreciated
    Vito

    Hi Vito,
    kudos for finding this interesting solution, and thanks for sharing !
    i think that this issue is something the developers at Adobe need to look into
    I don´t think they would have to make their mind up about rather special scenarios like this one -- that´s what I´d call "custom development", what you´ll always stumble across sooner or later. No "tool" on earth will ever be able to cover each and every scenario...
    Cheers,
    Günter Schenk
    Adobe Community Expert, Dreamweaver

  • Multiple Image Upload with Save to DB - any help would be appreciated

    Hi - I'm running into the following issue when using the Multiple Image Upload with Save to DB behaviour.
    When I click the link to upload multiple files, I am given the list of local files to choose to upload. No problem here - I can select multiple files.
    When i select choose, the uploader shows the progress but hangs at 0%
    However (if I cancel the uploads), the first image of the group is uploaded and it's corresponding database entry is entered correctly.
    Anyone else have this hangup? If so how did you get around it?
    Thanks!
    Dan

    Just thought I would update.
    The problem seems to be related to redirecting.
    I had specified a redirect page, which of course stops the flash file from continuing to upload images after the first one.
    Anyone know how to change this so when the flash uploader finished it goes back to a list page?
    Thanks again.

  • Restrict image pixel size in multiple image upload

    Re: Multiple Image Upload behaviour.
    One of the only issues I have with this extension is if users try to upload an image within the limits I set (of 250Kb) but with a high pixel count.
    For example, a jpg of 800 x 600 at 200Kb causes no problem, but a one of 2000 pixels at 150Kb probably will.
    I understand that there is probably more server load to resize a large pixel image, so is there a way to check the pixel size of images to be uploaded as well as the file size and reject it if it is too large?

    But what you could do, is retrieving the php.ini´s "post_max_size" value and display a note to your site visitors:
    <br />
    <br />
    <b>1.</b> put this into the doc´s head:
    <br />
    <br /><?php<br />$replace_max_size_MB = str_replace("M"," MB",ini_get('post_max_size'));<br />?>
    <br />
    <br />
    <b>2.</b> the related message:
    <br />
    <br />Pics larger than <?php echo $replace_max_size_MB; ?> will be rejected by the server
    <br />
    <br />Cheers,
    <br />Günter Schenk
    <br />Adobe Community Expert, Dreamweaver

  • Multiple Image Upload with save to database not working in IE anymore

    Since updating IE to SP3 ADDT Multiple Image Upload with save to database does not work anymore in IE. It will show a regular file upload field, an does not allow selection of multiple files. It does work in Firefox, but not all my clients use firefox.
    PSE Advice.

    I would consider buying some pluggins from dmxzone.com. They
    may cost a
    bit upfront but in the long run, you've probably be saving a
    lot of
    headaches.
    http://www.dmxzone.com/
    If time's an issue, with these plugins, you could probably
    be up and
    running in a half hour. George has some really nice pluggins
    for
    Dreamweaver and well worth the money.
    Peter Raun wrote:
    >
    I am going crazy here
    > I will see if i can explain my problem here. . .
    > I am trying to use the multiple image upload with save
    to database function in
    > the developer toolbox, and it work just fine, it lets me
    select where to store
    > the filename in database and where i want to save the
    actual image on the
    > server. It is wery easy to use if you just want these
    functions.
    > But i would also like to give every image a gallery id
    in the database, so i
    > can sort them out afterwards, its not whery smart to
    upload a lot of images to
    > a folder, and in the database you just have an image id
    and an filename, i cant
    > sort them into galleries with these to collums. . . . So
    i guess i have to do
    > something with the "additional fields" when i am
    creating the server behavior
    > but i cant figure out what to do?? i would have liked if
    i could have made an
    > list/menu with all of the availible galleries, and chose
    the one that i whould
    > add images too and then that gallery id whould be added
    to those images in the
    > database.
    > I have also tried to pass on an url parameter and then
    use that as a default
    > value in the "additionel field" section but without any
    luck at all. . . I hope
    > someone here has an idea, that could help me out. . .
    > It is sooooo easy to do this, when you are uploading ONE
    image at a time, i
    > cant figure out why it has to be sooooo hard when using
    "multiple image
    > upload"
    >

  • Multiple Image Upload not working on macs

    Hello everybody,
    I have searched everywhere for an answer to this issue and I'm not sure if there is a solution yet.
    I am hoping someone reads this and tells me if either I need to use another product or post a fix for this to work.
    I am developing a website for a photographer who needs to upload the pictures he takes for his clients to review on his website.
    So on the backend I have created an application where he logs in and creates a new client and then uploads multiple images to that client's folder.
    I am of course developing the site in ADDT version 1.0.1. in Dreamweaver CS4.
    Everything works as expected except for the image upload part, where he is unable to upload even a single image.
    He is using Mac OS X and Safari 3 to access his site.
    I use a PC and can upload images perfectly, but the whole purpose of the website is for him to be able to upload images without me.
    I read somewhere that ADDT's Multiple Image upload did not work on Macs because of the way that the OS handles image uploads to the server via HTTP. I also know that Flash v.10 had an issue with this behaviour in the past, but that it's been fixed with ADDT's v. 1.0.1, which is true since as I said I am able to upload images from my PC using that Flash version.
    There is a product called MultiPowUpload from Element-IT (http://www.element-it.com/MultiPowUpload.aspx) that seems to do the exact same thing as ADDT's Multiple Image Upload, and I have tested the Demo version both on Mac and PC and works perfectly well.
    I really would like my ADDT behaviour to work, first because I already have the whole site developed in it, plus I am used to the software already, and also because Element-IT's product is a bit pricey for a multiple server license (which I would need for other sites I plan to develop for Mac users).
    Any thoughts or pointers you might have will be greatly appreciated.
    Thank you in advance.
    Luis Herrero.

    Thanks a lot for your replies and helpful ideas.
    It turns out that for some strange reason the problem was with the hosting provider.
    I have moved another site which was not working with Macs either to a new provider and everything works now as it should be, without changing any files at all.
    I have in fact v.1.0.1 in both those sites (those were the first things I checked before posting here) and Flash Player v. 10 both on the Mac and PC, so it will remain a mystery as to why the server behavior did not work with that particular host on Macs.
    Thanks again.
    Best regards.

  • Upload Friendly (Multiple File Upload Applet)

    Title : Upload Friendly (Multiple File Upload Applet)
    Description : UploadFriendly is an easy to use Java Applet that will allow multiple file
    uploads on a web server in a web page. The control supports file filtering, limits and more.
    Samples available in the following languages: ASP, ASP.NET, PHP, Coldfusion and JSP
    Link: http://www.uploadfriendly.com/
    Type: Commercial (30 days Trial)

    Hi shiil,
    To move the documents between site collection, content organizer rules would be a recommended method, you can activate Content Organizer features to enable content organizer rules on the site, to root the document to another site collection.
    Also, for this issue, as Prasath suggested, you can check out the document in the ItemAdded event, then add ItemCheckedout event, in the ItemCheckedout event, delete the document. Or as content organizer rule does, you can create your own timer job to move
    the document.
    More information, Content Organizer Feature Overview for SharePoint Server 2010 Developers (ECM):
    http://msdn.microsoft.com/en-us/library/office/ee558288(v=office.14).aspx
    Thanks,
    Qiao Wei
    TechNet Community Support

  • Js-error while executing Multiple Image Upload wizard

    If i want to save the configured window of Multiple Image Upload with Save to Database wizard i get this js-error: "While executing onClick in MIUploadWSaveWizard.htm, a JavaScript error occured".
    can someone help?
    thanx
    peter

    That again would be more of a question for the Cold Fusion group.
    Try http://forums.adobe.com/community/coldfusion/coldfusion_administration
    Those people will be able to help you out more.
    Brad Lawryk
    Adobe Community Expert, Dreamweaver
    Adobe Usergroup Manager, Northern British Columbia Adobe User Group

  • How do I use CFTHREAD in combination with CFFILE Upload

    I've been reading how CFTHREAD is supposed to release the
    client so that long-lasting operations like a CFFILE upload can
    continue to do their business while the client does something else.
    How does this work exactly? I can't find any concrete
    references. For example, I have a regular file upload form. A user
    uploads a large file, say 100Mb, and I want to use CFTHREAD (or
    something) to handle the upload process, which I know may take
    hours depending on the connection, and immediately return the page
    for the client saying "Your file is being processed. Please check
    back later."
    I tried wrapping some CFFILE code with CFTHREAD, but when I
    ran it the page just sat there working while the file was being
    uploaded, so I did not witness any change whatsoever in how its
    being handled. What am I missing?
    <cfthread action="run" name="uploadVideo">
    <cffile
    action="upload"
    destination = "/var/www/video1/assetsIN"
    nameconflict="overwrite"
    filefield="video" />
    </cfthread>
    Thanks for any help.
    UPDATE: I asked Ben Forta this in an email yesterday and here
    was his response:
    What you are doing is correct. The actual file processing
    (getting the uploaded file) will not happen in a separate thread.
    Were you expecting a separate thread for the upload itself? CF
    can’t do that for you s CF does not have the file until it is
    uploaded. Actually, CF is not even called until the form is
    submitted (which includes the file being uploaded). It sounds like
    you want the browser to do an upload in the background. This may be
    doable using JavaScript and Ajax type controls. Or maybe using
    browser tabs or something. -Ben

    With file uploads the time consumption is between the client
    PC and the web
    server, not the web server and the CF server (which are
    usually on the same
    machine). All <cffile action="upload"> does is copy the
    uploaded file from
    the web server's temp upload dir to [wherever you tell it to
    go]: it's a
    local process, and should be fairly quick; certainly compared
    to the
    process of getting it to the web server in the first place.
    Even if the data transmission was between the client PC and
    the CF server,
    you can't expect <cfthread> to somehow increase the
    bandwitdh and speed up
    the file upload between the two machines.
    <cfthread> could come into its own if you had some file
    processing to
    perform on the file *after* it's uploaded: unzipping it,
    doing some image
    manipulation, parsing a CSV file into a DB, that sort of
    thing. Not for
    the initial upload.
    Adam

  • Multiple App syncing issues...

    Hello, all.
    I am having multiple application synching issues. I have a half dozen devices and have never had any of these issues before about a week ago. May have had an iTunes update? Here are the issues.
    1.     Some Apps re-installing even though no update was available.
    2.     Some apps not completely installing and showing with an empty progress bar through the icon.
    3.     Apps that are not supposed to sync to a particular device are.
    4.     Apps re-installing outside of their designated folders.
    Anyone having any of these issues? It is pretty frustrating since I never know what I am going to end up with after a sync.

    Sure.
    Only select the apps that you want to sync.
    It will only sync what you tell it to sync to each device.

Maybe you are looking for

  • GETTING DATA FROM ODS BY USING A FUNCTION MODULE..

    Hi Frnzs, Here is my issue..Plz go thru it.. I  have a function module (YFSF_ICR_GET_EXCHG_RATE_ODS). the function performs the current logic without any changes, that is reading SPOT rates for actuals (the planning cycle is empty) or S rates for for

  • Using Acrobat Designer 7

    I've created multiple forms, using Designer 7.0; however.... the digital signature fields will not function when the recipient (submitter) of the forms trys to click on the signature fields. Nothing happens, kinda frustrating. I was under the impress

  • My iPad 2 worked perfect before updating to iOS 8, now all it does is power cycle, even after restoring

    How can I downgrade to iOS 7?  I believe iOS8 is my problem.

  • Blog entry in iWeb via e-mail?

    Hello, I have an iWeb blog on MobileMe and wondering if it is possible to add blog entries via e-mail? (This feature would be very handy if one is away from his Mac...) Thanks, Attila

  • Ternary Association In a class diagram

    Hi Please help. I need to depict a ternary association icon between 3 Classes in my Class diagram. I am using Java Studio Enterprise 8's UML tool. The modeling palette does not make provision for this type of association. Is there a way to depict the