Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

slow file upload and an error

Posted on 2004-09-17
9
Medium Priority
?
175 Views
Last Modified: 2013-12-24
Hi, I have made a page where users can upload some word files,
the first problem is that the page is quit slow! is there reason for that.
The second problem is that if the user has the word file open (they can only upload word files) the server gives an error! how can one deal with that, other than to warn the users not to have their files open?
thanks
0
Comment
Question by:MMsabry
9 Comments
 

Author Comment

by:MMsabry
ID: 12090145
Also, in the next step, i.e. after the file has been uploaded there is a query to insert some values in an sql db, every once in a while, an error happens,
the error is : invalide synthax near ')"
here are the queries

<cftransaction>
      
      <cftry>
            <cflock type="readonly" scope="session" timeout="50" throwontimeout="no">
                  <cfset Abstr = Duplicate(Session.PartAct.Abst)>
                  <cfset Pinfo = Duplicate(Session.PartAct.Pinfo)>
            </cflock>
                  <cfquery name="Abst" datasource="#request.MyDSN#" username="#request.myusername#" password="#request.Mypassword#">
                        INSERT INTO Abst (Title, Location)
                        VALUES (<cfqueryparam cfsqltype="cf_sql_varchar" value="#Abstr[4]#">,
                                    <cfqueryparam cfsqltype="cf_sql_varchar"
                                    value="files\#form.filename#">)
                  </cfquery>
                  <cfquery name="AbstID" datasource="#request.MyDSN#" username="#request.myusername#" password="#request.Mypassword#">
                        SELECT Title, Abst_ID as ID FROM Abst
                        WHERE Title=<cfqueryparam cfsqltype="cf_sql_varchar" value="#Abstr[4]#">
                  </cfquery>
                  <cfquery name="TypeID" datasource="#request.MyDSN#" username="#request.myusername#" password="#request.Mypassword#">
                        SELECT Type, Type_ID AS TID FROM Type
                        WHERE Type=<cfqueryparam cfsqltype="cf_sql_varchar" value="#Abstr[2]#">
                  </cfquery>
                  <cfquery name="TopicsID" datasource="#request.MyDSN#" username="#request.myusername#" password="#request.Mypassword#">
                        SELECT Topic, Topic_ID As TOID FROM Topics
                        WHERE Topic=<cfqueryparam cfsqltype="cf_sql_varchar" value="#Abstr[3]#">
                  </cfquery>
                  <cfquery name="Insert1" datasource="#request.MyDSN#" username="#request.myusername#" password="#request.Mypassword#">
                        Insert into Cont (P_ID, Abst_ID, Type_ID, Topic_ID)
                        VALUES (#Pinfo[5]#,#AbstID.ID#,#TypeID.TID#,#TopicsID.TOID#)
                  </cfquery>
                  <cfquery name="Insert2" datasource="#request.MyDSN#" username="#request.myusername#" password="#request.Mypassword#">
                        Insert into Abst_Status  (Abst_ID)
                        VALUES (#AbstID.ID#)
                  </cfquery>
            <cfset SendEmail = 1>
      <cfoutput>
         some html
          </cfoutput>
           <cfcatch>
                 <cfoutput> some html</cfoutput>
            </cfcatch>
        </cftry>
       </cftransaction>
0
 
LVL 21

Accepted Solution

by:
pinaldave earned 800 total points
ID: 12090221
Hi MMsabry,

The reason for invalid entry around ) can be
1) there is null values are passed
2) the param is not properly scoped like variables.varname or url.varname or smoething
or may be something...

regarding slow as you know there can be many reasons like ram, server or may be it is slow due to any reason... internet or anything... so I do not see that as some big problem...

Regards,
---Pinal
0
 
LVL 25

Assisted Solution

by:James Rodgers
James Rodgers earned 400 total points
ID: 12090688
when the error is generated is therea line given? what is the code from that line?
you also stopped using cfqueryparam in your statements, you should always use this especially when using an insert statement, or at least be consistent in using it
you have a table named type with a column named type, type can be a key/reserved word - not a solution to your problem but somrthing to be aware of when naming vars, objects etc.
0
Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

 
LVL 17

Expert Comment

by:anandkp
ID: 12092152
i guess the way ur doing is not right ...

I suppose u wld wanna do FILE.SERVERFILE to insert the file name of the uploade file in the DB [after using CFFILE]

refer http://www.experts-exchange.com/Web/WebDevSoftware/ColdFusion/Q_20663901.html & lemme know ...
0
 

Author Comment

by:MMsabry
ID: 12095839
Jester_48,
The line that is give is number 2, and line 2 contains the code to resterict access to the page.!!
yes i also stopped using cfqueryparam, bec. all the values in this case are id numbers returned from other queries, so they info already on my db.

anandkp,
I do not understand your comment, since I do what you indicated, these queries are after the file has been uploaded.

also no one has gotten around to answer the question about file upload error when the word file is open, and sometimes it is a word file that is to be uploaded but it still gives the error that this is not a word file!
thanks
0
 
LVL 21

Expert Comment

by:pinaldave
ID: 12096023
hih, what is the code of uploading...
are you having some problem due to mime type or something ...?
0
 

Author Comment

by:MMsabry
ID: 12096275
this the code for uploading
<cffile accept="application/msword" action="upload" destination="C:\CFusionMX\wwwroot\site\Abstracts\" filefield="form.userfile" nameconflict="overwrite">

forget about the query problem, i solved it there was a typo in the values in the db, so in this sense Pinal was right, it was getting a null value.

now the problem i get with the upload is the following:
1- if the file to be uploaded is open in the application (in this case MS word) it throughs an error
2-once in a while, with certain files (i made sure that they are ms word) it insists that they are not.
0
 
LVL 21

Expert Comment

by:pinaldave
ID: 12096345

I think Q 1) is going to be like that. That is the system behaviour and property.
Try this mime types also for Q 2)
application/x-msdownload
Also some time Windows opens the file as that file could be opened with words but actually that can be any files adn we need specific mime types for them...
here is the list of some of the word related mime types try them....
http://www.utoronto.ca/ian/books/html4ed/appb/mimetype.html

Regards,
---Pinal
0
 

Author Comment

by:MMsabry
ID: 12096543
Pinaldave,
application/x-msdownload did not work at all, even for the files that used to work before,
the link you provided is very nice but not in this case, since they also indicate that for ms word, i would only use "application/msword"!
so any solutions!!
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month7 days, 21 hours left to enroll

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question