Retrieve File Type / Mime Type

Hi all,
I hava some files that are stores on a database as binaries files but without files extensions. And i don't know why but the original file name (with extension) is not stored.
I try to retrieve the extension of file using MIME but without success for the moment. Could you tell me if there any tools in JAVA of course that i can use to retrieve it ?
Thanks in advance for your help and answer.
Regards,
Denez

I would like to apologies.
After a long time of research in the javadoc I find how DROID works!
No it's ok i have adapted a part of code to obtain information that i want.
For your information it works with excel, word, zip for example.
I try with a text/plain file but it doesn"t work at all.
here is my code :
try {
AnalysisController analysisControl = new AnalysisController();
analysisControl.readConfiguration("DROID_config.xml") ;
analysisControl.readSigFile() ;
IdentificationFile identificationFile = new IdentificationFile("C:\\File");
ByteReader byteReader = null;
byteReader = newByteReader(identificationFile);
analysisControl.getSigFile().runFileIdentification(byteReader) ;
// display list of hits
for (int ih = 0; ih < byteReader.getNumHits(); ih++) {
String specificityDisplay = byteReader.getHit(ih).isSpecific()?
"specific" : "generic";
System.out.println(" " + byteReader.getHit(ih).getHitTypeVerbose() + " "
+ specificityDisplay + " hit for " +
byteReader.getHit(ih).getFileFormat().getName() + " [PUID: " +          
            byteReader.getHit(ih).getFileFormat().getPUID() + "]" + " [MIME: "
            + byteReader.getHit(ih).getFileFormat().getMimeType() + "]" );
if (byteReader.getHit(ih).getHitWarning().length() > 0) {
System.out.println(" WARNING: " +
byteReader.getHit(ih).getHitWarning());
} catch (Exception e) {
     Sstem.out.println("exception : " + e.getMessage()) ;
With a text/plain file "byteReader.getNumHits()" == 0.
So it's a condition to say that is a text/plain file.
Could you tell me if i'm wrong or not ?
thanks in advance,
Regards,
Denez

Similar Messages

  • When I attach a JPG file in my email and send it to a Windows friend they get the message "The file type being saved or retrieved has been blocked when they try to open it." Anyone know why and how to fix this problem?

    When I attach a JPG file in my email message and send it to a Windows friend they get the message "The file type being saved or retrieved has been blocked when they try to open it so that they can save it." Anyone know why and how to fix this problem?

    Your Windows friend should ask in a Windows forum why his email client won't open attached jpg files. We have no idea what email client he is using or how his Windows security is configured.

  • Recognizing mime uploaded file type

    Hi
    I'm trying to restrict the mime type of an uploaded file to .PDF only. I can have some validation by using FileItem.getContentType() method from Apache commons' fileupload framework or by using FileDataSource.getContentType() method from COS framework, but both of these methods simply match the extension of uploaded file with MIME mappings of the server. If a user takes a .doc file and saves it as .pdf, i still get content type application/pdf for that file. Is it possible to check for these scenarios somehow?

    You could give DROID (Digital Record Object Identification) a go:
    http://droid.sourceforge.net/wiki/index.php/Introduction

  • How are user-entered MIME applications defined to open certain file types. This used to be standard in browsers.

    In the not-terribly-recent past, browser Preferences allowed users to create associations between a file type (really, a file extension indicating its type) with an application used to run that type of file. Firefox seems to have buried this (on the Mac) in ~/Library/Application Support/Firefox/... ;in which seem to be an xml file.
    Is it possible to edit this xml file directly, and if so, where in the xml file should a new entry be placed, and what is the explicit syntax of an entry (other than obviously copying present entries)?
    These used to be called MIMEs.

    I am trying to use a rather older programming language called Mozart, an extension of OZ. I installed it as a binary, but instead of storing its component binaries in a place like /usr/local/oz/bin/. they are all enclosed inside the /Applications/Mozart.app/Contents/Resources/bin/. which cannot be opened nor can a soft link be made to it located outside the Mozart.app wrapper.
    The only alternative is to try to edit the mimeTypes.rdf files, and give it the full path name to the inside of Mozart.app were the program used for web applications is stored. It is stored in ~/Library/Application Support/Mozart/, which can only be accessed in more recent Mac OS X by going to finder and holding the Option key while opening the Go menu; this will make the ~/Library visible and accessible.

  • Java.lang.InstantiatiCould not read mime-mappings config file: ./mime.types

    I am about to had enough of this moronic container call OC4J that's compatible to to itself.
    I did a
    1. clean unzip and installation.
    2. setup admin account.
    3. config the autodeploy in server.xml (Who in their right phreakin mind design a container with no hot deploy nowaday).
    4. configure the data source.
    5. test data source using a webapp with one page jsp do a JSF jdbc connection.
    When try and deploy the error-free webapp (tested in tomcat) using both frontend and autodeploy,a cryptic error occur: could not read mime.types.
    I have never see this error before in my life. its in oracle.oc4j.admin.internal.ApplicationDeployer.addApplication
    This error happened after I configure my webapp to do phreakin orion-application.xml disable toplink, orion-webapp xml prefer local class file. If I don't get this resolve within couple days, I'll put my career on the line with full force and request we do not use OC4J anywhere in this group.
    A M$FT .NET project looks very promising and efficient compare this deployment hell they call OC4J
    2007-06-20 13:22:50.500 NOTIFICATION Application Deployer for norm STARTS.
    2007-06-20 13:22:50.546 NOTIFICATION Copy the archive to C:\oc4j101320_SA\j2ee\home\applications\norm.ear
    2007-06-20 13:22:50.890 NOTIFICATION Initialize C:\oc4j101320_SA\j2ee\home\applications\norm.ear begins...
    2007-06-20 13:22:50.890 NOTIFICATION Auto-unpacking C:\oc4j101320_SA\j2ee\home\applications\norm.ear...
    2007-06-20 13:22:50.890 NOTIFICATION Unpacking norm.ear
    2007-06-20 13:22:50.890 NOTIFICATION Unjar C:\oc4j101320_SA\j2ee\home\applications\norm.ear in C:\oc4j101320_SA\j2ee\home\applications\norm
    2007-06-20 13:22:53.625 NOTIFICATION Done unpacking norm.ear
    2007-06-20 13:22:53.625 NOTIFICATION Finished auto-unpacking C:\oc4j101320_SA\j2ee\home\applications\norm.ear
    2007-06-20 13:22:53.640 NOTIFICATION Auto-unpacking C:\oc4j101320_SA\j2ee\home\applications\norm\norm.war...
    2007-06-20 13:22:53.640 NOTIFICATION Unpacking norm.war
    2007-06-20 13:22:53.640 NOTIFICATION Unjar C:\oc4j101320_SA\j2ee\home\applications\norm\norm.war in C:\oc4j101320_SA\j2ee\home\applications\norm\norm
    2007-06-20 13:22:59.828 NOTIFICATION Done unpacking norm.war
    2007-06-20 13:22:59.828 NOTIFICATION Finished auto-unpacking C:\oc4j101320_SA\j2ee\home\applications\norm\norm.war
    2007-06-20 13:22:59.906 NOTIFICATION Initialize C:\oc4j101320_SA\j2ee\home\applications\norm.ear ends...
    2007-06-20 13:22:59.906 NOTIFICATION Starting application : norm
    2007-06-20 13:22:59.906 NOTIFICATION Initializing ClassLoader(s)
    2007-06-20 13:22:59.906 NOTIFICATION Initializing EJB container
    2007-06-20 13:22:59.906 NOTIFICATION Loading connector(s)
    2007-06-20 13:23:00.062 NOTIFICATION Starting up resource adapters
    2007-06-20 13:23:00.078 NOTIFICATION Initializing EJB sessions
    2007-06-20 13:23:00.078 NOTIFICATION Committing ClassLoader(s)
    2007-06-20 13:23:00.078 NOTIFICATION Initialize norm begins...
    2007-06-20 13:23:00.187 NOTIFICATION application : norm is in failed state
    07/06/20 13:23:00 WARNING: Application.setConfig Application: norm is in failed state as initialization failed.
    java.lang.InstantiationException: Error loading web-app 'norm' at C:\oc4j101320_SA\j2ee\home\applications\norm\norm: Could not read mime-mappings config file: ./mime.types
    07/06/20 13:23:00 oracle.oc4j.admin.internal.DeployerException: java.lang.InstantiationException: Application: norm is in failed state as initialization failed
    07/06/20 13:23:00 at oracle.oc4j.admin.internal.ApplicationDeployer.addApplication(ApplicationDeployer.java:515)
    07/06/20 13:23:00 at oracle.oc4j.admin.internal.ApplicationDeployer.doDeploy(ApplicationDeployer.java:196)
    07/06/20 13:23:00 at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:93)
    07/06/20 13:23:00 at oracle.oc4j.admin.jmx.server.mbeans.deploy.OC4JDeployerRunnable.doRun(OC4JDeployerRunnable.java:52)
    07/06/20 13:23:00 at oracle.oc4j.admin.jmx.server.mbeans.deploy.DeployerRunnable.run(DeployerRunnable.java:81)
    07/06/20 13:23:00 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
    07/06/20 13:23:00 at java.lang.Thread.run(Thread.java:595)
    07/06/20 13:23:00 Caused by: java.lang.InstantiationException: Application: norm is in failed state as initialization failed
    07/06/20 13:23:00 at com.evermind.server.Application.setConfig(Application.java:497)
    07/06/20 13:23:00 at com.evermind.server.Application.setConfig(Application.java:340)
    07/06/20 13:23:00 at com.evermind.server.ApplicationServer.addApplication(ApplicationServer.java:1879)
    07/06/20 13:23:00 at oracle.oc4j.admin.internal.ApplicationDeployer.addApplication(ApplicationDeployer.java:512)
    07/06/20 13:23:00 ... 6 more
    07/06/20 13:23:00 Caused by: java.lang.InstantiationException: Error loading web-app 'norm' at C:\oc4j101320_SA\j2ee\home\applications\norm\norm: Could not read mime-mappings config file: ./mime.types
    07/06/20 13:23:00 at com.evermind.server.http.XMLHttpApplicationConfigContext.getConfiguration(XMLHttpApplicationConfigContext.java:155)
    07/06/20 13:23:00 at com.evermind.server.Application.getHttpApplicationConfig(Application.java:593)
    07/06/20 13:23:00 at com.evermind.server.Application.initHttp(Application.java:1345)
    07/06/20 13:23:00 at com.evermind.server.Application.setConfig(Application.java:451)
    07/06/20 13:23:00 ... 9 more
    2007-06-20 13:23:00.218 NOTIFICATION Application Deployer for norm FAILED.
    2007-06-20 13:23:00.218 NOTIFICATION Application UnDeployer for norm STARTS.
    2007-06-20 13:23:00.281 NOTIFICATION Removing all web binding(s) for application norm from all web site(s)
    07/06/20 13:23:00 SEVERE: ProgressObjectImpl.reportError java.lang.InstantiationException: Application: norm is in failed state as initialization failedoracle.oc4j.admin.jmx.shared.exceptions.InternalException: java.lang.InstantiationException: Application: norm is in failed state as initialization failed
    at oracle.oc4j.admin.jmx.shared.deploy.NotificationUserData.<init>(NotificationUserData.java:107)
    at oracle.oc4j.admin.internal.Notifier.reportError(Notifier.java:429)
    at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:123)
    at oracle.oc4j.admin.jmx.server.mbeans.deploy.OC4JDeployerRunnable.doRun(OC4JDeployerRunnable.java:52)
    at oracle.oc4j.admin.jmx.server.mbeans.deploy.DeployerRunnable.run(DeployerRunnable.java:81)
    at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
    at java.lang.Thread.run(Thread.java:595)
    Caused by: oracle.oc4j.admin.internal.DeployerException: java.lang.InstantiationException: Application: norm is in failed state as initialization failed
    at oracle.oc4j.admin.internal.ApplicationDeployer.addApplication(ApplicationDeployer.java:515)
    at oracle.oc4j.admin.internal.ApplicationDeployer.doDeploy(ApplicationDeployer.java:196)
    at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:93)
    ... 4 more
    Caused by: java.lang.InstantiationException: Application: norm is in failed state as initialization failed
    at com.evermind.server.Application.setConfig(Application.java:497)
    at com.evermind.server.Application.setConfig(Application.java:340)
    at com.evermind.server.ApplicationServer.addApplication(ApplicationServer.java:1879)
    at oracle.oc4j.admin.internal.ApplicationDeployer.addApplication(ApplicationDeployer.java:512)
    ... 6 more
    Caused by: java.lang.InstantiationException: Error loading web-app 'norm' at C:\oc4j101320_SA\j2ee\home\applications\norm\norm: Could not read mime-mappings config file: ./mime.types
    at com.evermind.server.http.XMLHttpApplicationConfigContext.getConfiguration(XMLHttpApplicationConfigContext.java:155)
    at com.evermind.server.Application.getHttpApplicationConfig(Application.java:593)
    at com.evermind.server.Application.initHttp(Application.java:1345)
    at com.evermind.server.Application.setConfig(Application.java:451)
    ... 9 more

    Thank you Steve for your help. I really do appreciate ppl taking the time to answer questions from n00b like me.
    I tried and disable global.libraries and global.tag.libraries when deploy, and at one point the login page (its Spring 1.2.8 + hibernate 3.1.3 + Myface 1.1.4 + acegi 1.0.1 ) came out, but cannot login and without exceptions, so I was guessing acegi poblem. But the spring and hibernate is working, I can see the conn and other activities. And after a couple tries, cannot even get the login page display now in MyFace, with exceptions:
    include(java.lang.String) in javax.servlet.jsp.PageContext cannot be applied to (java.lang.String,boolean)
    And then after some googling found out there will be code change for this webapp as well.
    - change webapp.listener for double instantiation in OC4J (Code Change)
    - create new class OrionSessionListener implements HttpSessionListener for session invalidation (Code Change) NEW JAVA CLASS
    - acegi j_security_check URL reference change (Code Change, but minor)
    I think the container has great performance, but I just wish they can look more to the compatabilities/common practices issues
    full stacktrace:
    2007-06-22 14:12:04.437 NOTIFICATION J2EE JSP-0008 Unable to dispatch JSP Page : oracle.jsp.provider.JspCompileException: Errors compiling:C:\oc4j101320_SA\j2ee\home\application-deployments\norm\norm\persistence\_pages\\_login.java
    [jsp src:line #:13] include(java.lang.String) in javax.servlet.jsp.PageContext cannot be applied to (java.lang.String,boolean)
    pageContext.include( __url,false);
         at oracle.jsp.app.JspJavacCompiler.compile(JspJavacCompiler.java:304)
         at oracle.jsp.runtimev2.JspPageCompiler.attemptCompilePage(JspPageCompiler.java:731)
         at oracle.jsp.runtimev2.JspPageCompiler.compileBothModes(JspPageCompiler.java:456)
         at oracle.jsp.runtimev2.JspPageCompiler.compilePage(JspPageCompiler.java:413)
         at oracle.jsp.runtimev2.JspPageInfo.compileAndLoad(JspPageInfo.java:705)
         at oracle.jsp.runtimev2.JspPageTable.compileAndServe(JspPageTable.java:694)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:414)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:597)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:521)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
         at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:118)
         at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
         at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:375)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:17)

  • Where are fIle type / MIME preferences?

    I have run into a bit of a problem. I can't force Safari to download a certain type of file instead of trying to view it as text.
    There is a Flash-site that links to a nice file I want to download. The file is "rare" and possible misunderstood by the server. It is displayed in Safari as text, even though it clearly is a compiled file. Since it is a Flash-site, I can't use my usual quick fix of alt-clicking (opt-clicking in pure mac-speak) on the link.
    I have not been forced to add a file-type handler for years and can't find it. It was there in Netscape 4
    If anyone wants all the details this is the site I am trying to download from:
    http://cms.beaver82.com/?section=8
    choose to download one of the MXP files (Flash plugins) and they should show up in Safari as text-garbage.

    Hi Martin,
    Have you tried just letting the file load and then selecting 'Save As...' from the File menu?
    Instead of saving it with the default .txt extension just remove that to have it end with .mxp.
    Of course I don't have anything to actually test if the file works or not though... but I'm sure you'll let us know

  • Data Recover From Formatted Drive? What is the best program to use to get back Logic Projects and any other file type?

    I was in the process of reorganising my hard drives so I could RAID them however I managed to corrupt one drive and had to format it which meant I lost all my Logic Files and some other files. I managed to save a lot of files (mainly video files) before I had to format the drive but I need a Data Recovery service that will not alter anything on the hard drive and will put all the formatted files (regardless of the type) back for me so I can get the rest of the ones I need.
    Thanks in advance.

    What about folders and such?
    No. FS doesn't reconstruct folders. However, Data Rescue does, depending on how you use it. About the only thing in Data Rescue a Quick Scan ever seems to show you are files that are already live.
    So that leaves you with a Deep Scan, or a Deleted Files scan. The first pass of a Deep Scan will attempt to retrieve folders and files, along with their original names. The second pass only looks for file patterns. Like recognizing a Photoshop .psd file. It will recover it, but give it a nonsense name. A Deleted Files scan only results in nonsense names of recognized file types; no folders.
    What were you using File Salvage on? A hard drive?
    Yes, though you can use it on a flash drive, or any other mounted drive.
    At the moment it is estimating 289 hours remaining on a 1TB drive. Can it not go faster?
    No, both of the software mentioned are slower than molasses in January. When you delete anything in Windows, its file table entry simply tagged as deleted. So to unerase them, the tag is removed. That's why it works to quickly and easily (assuming you haven't already overwritten the data to be recovered).
    In OS X though, the whole idea of the underlying UNIX structure is all about security. It's not supposed to be easy to retrieve deleted items. When you delete items, their file table entries are erased. So the only way to find deleted items is to scour the entire drive for BOF (Beginning Of File) markers that don't have a matching starting block to anything that is in the file table.
    Another question, half the drive was empty. Will it fly over that empty space or will it sieve through it incase there was some files stored on it?
    If you use the Expert mode is FS, you can choose to do that:

  • How to read the content of .msg file type with attachments in SAP crm?

    Hi All,
    Need to develop a RFC FM which will take any BP number as input
    Read the attachments in the BP and identify the attachment which is an email( .msg).
    Identify by the mime type and file extension
    Scan through the email to get the attachments of that email read the content of the
    attachment as a binary file and return that binary file with file name, size
    etc.
    I need to read the data (in binary format) attachment of an attachment of .msg file type .
    I have done till step 2 .
    Please help me on step 3.
    Thanks&Regards,
    Pratap Naik

    Can any one help me on this ?
    Thanks in advance.
    Regards,
    Pratap Naik

  • Using the value "Image/*" for the accept attribute of the HTML input Element, how can I add .pdf to the array of preconfigured file types (.jpe, .jpg, .jpeg, .?

    On a form, using the value "image/*" for the accept attribute of the HTML input Element, how can I add .pdf to the array of pre-configured file types (.jpe, .jpg, .jpeg, .gif, .png, .bmp, .ico, .svg, .svgz, .tif, .tiff, .ai, .drw, .pct, .psp, .xcf, .psd, .raw)?
    Say I wanted to add .gif, .jfif or .ico. I find this array limited, how can I add types to image?
    <input type="file" name="file" accept="image/*" id="file" />
    mimeTypes.rdf does not seem to allow this.

    ''mimeTypes.rdf'' has nothing to do with web development. It's a file that stores your file handling preferences (e.g. if you want ZIP files automatically saved or opened).
    You can't change the file types of the pre-defined content specifiers (audio/*, video/*, image/*), but you can specify additional MIME types. To add PDF to your above example,
    <pre><nowiki><input type="file" name="file" accept="image/*,application/pdf" id="file" /></nowiki></pre>
    For details, see
    * [https://developer.mozilla.org/En/HTML/Element/Input developer.mozilla.org/En/HTML/Element/Input]

  • Have file save dialog configure csv file type

    I am saving a program recipe file in csv format.
    I can save and retrieve the file without problems.
    What I would like to do is have the save file dialog box show a file type of *.csv instead of the default all file types *.* and then depend on the user to enter file.csv
    Does anyone know a way to do this programitically?
    Solved!
    Go to Solution.

    Hi Clark,
    the FileDialog has some "pattern label" inputs. Have you used them or read the context help for that function?
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Setting file type to open in WebStart Program (Opened file as parameter)

    Hi --
    I've created a Java program & installed in on my PC using Web Start. Now I'd like set all .sit files to automatically open in my program. My program expects a file as input, and I'd like the opened .sit file to be that parameter.
    I've tested this using a batch file to run the program (instead of Web Start), and that worked fine. I'm not able to get this to work with a Web Start program, though.
    I opened My Computer & went to Tools / Folder Options / File Types. I created an SIT extention, and I tried a number of things:
    1. I had Web Start place a shortcut on the desktop, and then I selected that shortcut from the list in the File Types window --> I got a "TooManyArgumentsException" when I double-clicked on the .sit file.
    2. I tried to set the File Types setting to http://myserver/myapp.jnlp. --> Windows recognized that this wasn't an executable & wouldn't let me save it.
    3. I created a shortcut to http://myserver/myapp.jnlp and pointed the File Types setting to that. --> Windows wouldn't let me save that.
    4. I clicked the Advanced button on the File Types tab, and created an open action. I tried the same three things there & got the same results.
    Is it possible to do what I'm trying to do (force .sit files to open in my Java Web Start program and send their filename into the program's main method as a parameter)? Does anyone have any pointers?
    Thanks,
    Bonnie

    This is a new feature in Java Web Start 1.5, and in the 1.5 version of the JNLP specification.
    The <association> tag in the jnlp file can be used to ask Web Start to create the fextension/mime-type asociation for ".sit" extensions so that if you click on a ".sit" file, the system will launch "javaws -open clickedfile.sit yourapp.jnlp" see:
    http://jcp.org/aboutJava/communityprocess/maintenance/jsr056/jnlp_spec.html#4756982
    http://java.sun.com/j2se/1.5.0/docs/guide/javaws/developersguide/syntax.html#information
    /Dietz

  • Server side validation for file type with cffil sent via cfmail problem

    Hello;
    I have a small app that I need to allow users to be able to use a form, and send me and email with a file attachment. I have it working nicely, I included file manipulation into the validation process of the form and required form fields. The problem I'm having, is this. I'm trying to create and instance where if they try and upload lets say a pdf, it throws and error: "You are trying to upload the wrong file, please try again we only accept bla bla bla" Problem is, even if I'm uploading the proper file, it's rejecting it and deleting it. Can someone help me fix this? I've tried a number of different ways and can't seem to get this to go off properly. I am posting some of the code. There is a ton, so I'm posting the main parts so you get the idea and see my variables.
    <!--- Declairing my variables and setting up form validation--->
    <cfparam name="FORM.descript" type="string" default=""/>
    <cfparam name="FORM.attachment_1" type="string" default=""/>
    <cfset arrErrors = ArrayNew( 1 ) />
    <cfset showForm = true>
    <cfif structKeyExists(form, "sendcomments")>
    <cfif NOT len(trim(FORM.name))>
    <cfset ArrayAppend(arrErrors,"Your Full Name!<br>") />
    </cfif>
    <!--- This is where the file error control is as you can see how the name is validated, the file will be dealt with in a similar maner--->
    <cfif NOT Len(Trim(FORM.attachment_1))>
    <cfset ArrayAppend(arrErrors,"You didn't attach a file!<br>") />
    <cfelseif ArrayLen( arrErrors )>
    <cftry>
    <cffile action="DELETE" file="#FORM.resume#"/>
    <cfcatch>
    <!--- File delete error. --->
    </cfcatch>
    </cftry>
    <cfelse>
    <!--- no errors with the file upload so lets upload it--->
    <cftry>
    <cfset request.AcceptImage="image/gif,image/jpg,image/jpeg,image/pjpeg,image/x-png">
    <cffile action="upload"
                     filefield="attachment_1"
                     accept="#request.AcceptImage#"
                     destination="c:\websites\187914Kg3\uploads\"
                     nameconflict="Makeunique">
    <!---
    Now that we have the file uploaded, let's
    check the file extension. I find this to be
    better than checking the MIME type as that
    can be inaccurate (so can this, but at least
    it doesn't throw a ColdFusion error).
    --->
    <cfif NOT ListFindNoCase("request.AcceptImage",CFFILE.ServerFileExt)>
    <cfset ArrayAppend(arrErrors,"Only JPEG, GIF, and PNG file formats are accepted!<br>") />
    <!---
    Since this was not an acceptable file,
    let's delete the one that was uploaded.
    --->
    <cftry>
    <cffile action="DELETE" file="#CFFILE.ServerDirectory#\#CFFILE.ServerFile#"/>
    <cfcatch>
    <!--- File Delete Error. --->
    </cfcatch>
    </cftry>
    </cfif>
    <!--- This is the code that is causing my problem. The above code is saying everything is not the proper file and rejecting it all--->
    Can anyone help me out. I can make more of this code available if needed. Like i said, there's a lot and I didn't want to dump it all out, this is the section creating the problem. There are no errors at this time, just rejecting all file types.
    thank you.

    It appears you are comparing your content_length with 1MB.
    1KB: 1024 bytes
    1MB: 1024*1024 bytes
    Let us use max allowable size of 25KB here and amend the second half of our code.
    <!--- Set max allowable file size in KB at the top --->
    <cfset maxFileSize = 25>
          <!--- Check if file is an image file of acceptable size --->
          <cfif (#reFindNoCase("gif|jpg|jpeg|pjpeg|png",myResult.clientFileExt, 1)# EQ 1) AND (#myResult.FileSize# LTE (#maxFileSize#*1024))>
                <!--- Retain if right file type and size --->
                <p>
                Your file <strong>#myResult.clientFile#</strong> has been uploaded successfully!<br />
                <a href="yourTemplate.cfm">Back</a></p>
                <!--- Otherwise if wrong type --->
          <cfelseif #reFindNoCase("gif|jpg|jpeg|pjpeg|png",myResult.clientFileExt, 1)# NEQ 1>
                <p>
                You are trying to upload a <strong>#myResult.clientFileExt#</strong> file, please try again. We only accept <strong>gif, jpg, jpeg, and png</strong>.
                </p>
                <!--- Delete unacceptable file and show form to user to try again--->  
                <cffile action="delete"  file="#svrFile#" />
                      <form method="post" action=#cgi.script_name# 
                      name="uploadForm" enctype="multipart/form-data">
                      <input name="attachment_1" type="file">
                      <br>
                      <input name="submit" type="submit" value="Try again!">
                </form>
                <!--- Or size too large --->
          <cfelseif #myResult.FileSize# GT (#maxFileSize#*1024)>
                <p>
                Your file was too large (<strong>#numberFormat(myResult.fileSize/1024, "____.__")# KB</strong>). Please try a smaller file!
                </p>
                <!--- Delete file and show form--->
                <cffile action="delete"  file="#svrFile#" />
                      <form method="post" action=#cgi.script_name# 
                      name="uploadForm" enctype="multipart/form-data">
                      <input name="attachment_1" type="file">
                      <br>
                      <input name="submit" type="submit" value="Try again!">
                </form>
          </cfif>
    </cfif>        <!--- Closes the cfif tag which started from the first half --->
    </cfoutput><!--- ditto --->

  • How to repair File Type Associations

    Hi, I have a problem with being unable to mount *.bin files by double clicking them.
    They seem to be associated with VLC at the moment, and I would like to know how to return it so that these *.bin files are automatically mounted/opened when downloaded.
    Which application should I choose to associate *.bin files with so I can do this?
    Is there a different way of taking care of this problem?
    Additionally, I have removed VLC from my computer for this reason, and is there any other thing I should have done besides deleting the VLC folder I had made to contain that application? (e.g. an uninstall)
    I'm a new Mac user so I need a little help

    Hi, lunarist.
    I tested your link using two browsers: OmniWeb and Safari.
    1. With OmniWeb, it downloaded the .bin, invoked my copy of StuffIt Deluxe, scanned it with Norton AntiVirus, decompressed the .bin and mounted the disk image included therein. My StuffIt preferences are set to scan files with NAV before decompressing them. OmniWeb "knows" to use StuffIt Deluxe to expand the .bin because of the file's MIME type and, as a result of having StuffIt Deluxe installed on my Mac, Launch Services has associated StuffIt Deluxe with files of this type.
    Launch Services is the underlying mechanism in Mac OS X that associates documents with applications and vice-versa.
    2. With Safari, the bin was downloaded and decompressed. I was warned the disk image contained a program, and when I accepted that it should be mounted, it was.
    What you're seeing here is that Safari contains the code necessary to decompress the .bin and will do so if "Open Safe Files" is specified in Safari > Preferences > General. That Safari can perform this is common with many Mac-based Internet applications, e.g. browsers, FTP clients, even some mail clients. See section [2.4] of the comp.sys.mac.com FAQ where it states:"almost all modern Macintosh telecommunications and Internet programs have the capability of converting and unconverting MacBinary files for you."However, as previously noted in other posts, you don't have an application installed that will permit you to decompress these files by simply double-clicking them. For that, you need something like StuffIt Expander, a free version of which can be found here. Tiger, unlike prior versions of Mac OS X, does not include Stuffit Expander: see "Mac OS X 10.4: Where is StuffIt Expander?"
    So, as others have advised, install the free version of StuffIt Expander in order to decompress .bin files by double-clicking them.
    They're presently associated with VLC as VLC must claim .bin as a file extension or the MIME type "application/x-macbinary" as one it can open, hence Launch Services has decided that, based on the apps you have installed, that VLC is the only app that claims this file type.
    Good luck!
    Dr. Smoke
    Author: Troubleshooting Mac® OS X

  • Open File dialog box pops up even when file type is supposed to automatically open

    Even though I have selected "Do this automatically for files like this" the dialog still pops up when I click on that file type.
    Thanks

    An automatically download action is tied to a specific MIME type that the server send via the HTTP response headers and not to the file extension.<br />
    So it is possible that you have created this action for a different (or generic) file type.
    *http://kb.mozillazine.org/File_types_and_download_actions
    *https://support.mozilla.org/kb/change-firefox-behavior-when-open-file

  • Import from URL with out knowing the file types

    Hello Gurus,
    I am struck in a strange situation, We need to import files through URL , they may be tiff, pdf, word,excel ...
    and you dont know the file type until you open the URL,
    So i used both ORDIMAGE and ORDDOC for importing, if the import fails in the ORDIMAGE process due to data curropt error , it goes to ORDDOC and the error is taking way too much time to appear.
    1) Is there any way we can find the file type when we open the URL to check if it is a DOC file or Image File.
    2) Is there any way to reduce the time taken to show up the error.
    Thank you

    In Your case, you may need finer control that what import provides.
    You can also use the uri types to upload the image and extract the mime type from the response. You can do the same for orddoc. orddoc may take a long time to parse since the blob must be scanned.
    Larry
    create table uri_imgupload(item_id number primary key, pict ordsys.ordimage);
    create or replace procedure upload_uri_image(prikey_id number, url varchar2 )
    as
    imgobj ORDSYS.ORDImage;
    ctx raw(4000):=null;
    thisrowid urowid;
    urityp sys.URIType;
    BEGIN
    urityp := SYS.URIFactory.getURI(url);
    imgobj := ORDSYS.ORDImage.init();
    imgobj.source.localdata := urityp.getBlob();
    imgObj.setMimeType(urityp.getContentType());
    begin
    imgobj.setProperties();
    Exception
    when others then
    null; -- Ignore exceptions, mimetype is enough.
    end;
    insert into uri_imgupload t (item_id, pict)
    values (prikey_id, imgobj);
    commit;
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.put_line('EXCEPTION caught '||sqlcode||' '||sqlerrm);
    END;
    show errors;
    DECLARE
    Image ORDSYS.ORDImage;
    ctx raw(4000):=null;
    BEGIN
    utl_http.set_proxy('www-proxy.us.oracle.com:80','*.us.oracle.com');
    upload_uri_image(1, 'http://www.oracle.com/admin/images/ocom/oralogo_small.gif');
    END;
    show errors;

Maybe you are looking for

  • Emptying Delta queues before filling a setup table

    How do I empty the delta queues?  I want to carry out this task just prior to filling a setup table.  Thanks

  • DBMS_XMLSave.insertXML slow.

    Hi, I am using the function DBMS_XMLSave.insertXML to take a clob (XML file) off a queue, and process the file into a table. I am finding that inserting 10,000 records (from a single clob) is taking over 30secs. This is an order of magnitude out from

  • LDAP Integration

    Background: The most recent Novell eDirectory has something called LUM (Linux User Management) that automatically manages UNIX attributes for login. With some simple attribute mappings we have authentication working. All in all, configuring our first

  • I have CC. Why do I have to pay more to export?

    I have CC. Why do I have to pay more to export?

  • Shipment cost transfer

    Hi Guys, There is a case in our project where in some cases, shipment cost is transferred automatically whereas, in other cases,shipment cost is not transferred automatically although all the paramaters were found be to similar in both the cases. Use