Simple file loader with cffile

Hello;
I'm trying to make a basic file loader for my web site. I've written the file upload, and it works. I'll attach that code. I was wondering if someone could help me over this small hurdle I need to get past... let me explain.
I have an admin section in my web site. This file loader is to add new thumbnail images to a db record and show it on the front end. There is an option to either edit and existing record, or add a new record.
When you get to the editor, I'm putting in a link for a pop up window that has this file loader in it. What I want to do it after you load this file, I need it to be able to close the window and add it to the editor section so the file name can be loaded into the database.
Is this possible and kind of simple? I realize nothing is too simple doing this kind of programming, I'm just trying to find a decent solution that works. Maybe there is a tutorial out there for this kind of thing? Or maybe someone can help me with a couple lines of code so I can take it from there?
This is my file loader:
<cfset UploadFolder="c:\Inetpub\wwwroot\website\img\babies">
<cfif IsDefined("Form.UploadFile") AND Form.UploadFile NEQ "">
<cffile
     action="upload"
        filefield="UploadFile"
        destination="#UploadFolder#"
        nameconflict="overwrite"
        >
File uploaded successfully!
    <br />
    Uploaded file: <cfoutput>#cffile.ClientFile#</cfoutput>
<cfelse>
Select a file first!       
</cfif>
<form name="UploadForm" method="post" enctype="multipart/form-data" action="">
<input type="file" name="UploadFile">
    <input type="submit"  name="submit" value="Upload"/>
</form>
I can also post the db code for the page I'm loading it into if need be. I would have to refresh the page I believe to get the info from the pop up to the parent window that spawned it. I have a script for that:
<a href="javascript:opener.top.location=('/test/edit-record.cfm');" onclick= "javascript:window.close();">close window</a>
can anyone help me make this work properly? OR point me in a direction of a tutorial for a simple file loader of this type?
thank you.

I was wondering if Ajax would be a good solution. Can you tell me this
? I have a file loader I use all the time, but on this server, it's not working properly. Can you look at my code and possibly tell me why? I
know this is a lot of code I'm pasting, but it is pretty strait forward. It doesn't thrown an error, it just doesn't load the file
at all.
I would rather use this, I have it all written:
<!--- form submitted --->
<!--- set file uploading vars --->
<cfparam name="fileuploaded" type="boolean" default="false">
<cfparam name="uploadedfile" default="">
<cfset pathToFile = "c:\Inetpub\wwwroot\website\img\babies">
<!--- --->
<cfif len(trim(form.MYFile))>
<!--- if a file has been selected --->
<!--- try uploading new file --->
<cftry>
<cffile Action="upload" filefield="MYFile" accept="image/gif,
image/jpg, image/jpeg, image/pjpeg"
destination="#pathToFile#" nameconflict="MAKEUNIQUE">
<cfset fileuploaded = true>
<cfset uploadedfile = cffile.serverfile>
<cfcatch type="any">
<!--- if upload did not suceed, reset file uploading vars --->
<cfset fileuploaded = false>
<cfset uploadedfile = "">
<!--- this can be further enhanced by setting some var to hold error
message and return it to user --->
</cfcatch>
</cftry>
</cfif>
<cfif form.id gt 0><!--- we are updating an existing record --->
<!--- if new file upload was successful and the feature has an image
associated with it - delete old image --->
<cfif fileuploaded is true AND len(trim(form.oldimage))>
<cfif FileExists(pathToFile & form.oldimage)>
<cffile action="delete" file="#pathToFile & form.oldimage#">
</cfif>
</cfif>
<cfquery datasource="#APPLICATION.dataSource#">
UPDATE baby_port
SET
baby_port.dob=<cfqueryparam cfsqltype="CF_SQL_DATE" value="#form.edit1#">,
baby_port.Fname=<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.Name#">,
baby_port.Lname=<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.Lname#">,
<cfif fileuploaded is true>
baby_port.MYFile=<cfqueryparam cfsqltype="cf_sql_varchar" value="#uploadedfile#">,
</cfif>
baby_port.Body=<cfqueryparam cfsqltype="cf_sql_longvarchar" value="#form.PDSeditor#">,
baby_port.weight=<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.weight#">,
baby_port.TimeB=<cfqueryparam cfsqltype="CF_SQL_TIME" value="#form.tob#">
WHERE ID = <cfqueryparam value="#form.ID#" cfsqlType="CF_SQL_INTEGER">
</cfquery>
<cfelse><!--- we are inserting a new record --->
<cfquery datasource="#APPLICATION.dataSource#">
INSERT INTO baby_port
(dob, Fname, Lname, MYFile, Body, weight, TimeB)
VALUES
(<cfqueryparam cfsqltype="CF_SQL_DATE" value="#form.edit1#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.Name#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.Lname#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#uploadedfile#" null="#NOT fileuploaded#">,
<cfqueryparam cfsqltype="cf_sql_longvarchar" value="#form.PDSeditor#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#form.weight#">,
<cfqueryparam cfsqltype="CF_SQL_TIME" value="#form.tob#">)
</cfquery>
</cfif>
this is the 2 fields on the form that is submitting the file:
<input type="hidden" name="oldimage" value="#MYFile#">
<input name="MYFile" type="file" id="MYFile">
I can make more available if you need it, I didn't want to unload a ton of code on you.This is a stand alone server running coldfusion 8.1 standard if that makes a difference, it is not a shared environment. I have this code working on shared environments.

Similar Messages

  • Incremental file load with agent scheduler

    Hello.
    I have a problem with agent scheduler. At first Ill describe what I do:
    I wanna load data from files named xx_20100101, xx_20100102, xx_20100103, and so on..
    - I created interface which loads data into oracle table.
    - File Data store (resource name) is called #file_name. #file_name is Variable computed from metadata table.
    - This metadata table contains data about files and statuses. E.g. columns (File name,File date, Status) data (xx_20100101,20100101,READY).
    - I created Procedure which sets Status from READY to DONE after successfull load from every file into table.
    - All these steps are in Package. So when I run this package (with steps: Declare variable -> run Interface -> Run package -> Refresh variable).
    - Variable is computed as record with min(File Date) and Status = 'READY'
    After execution of package everything looks ok.
    But when I execute Package via agent scheduler only step with Interface is correctly runned. Packege which changes status of file load does no update and variable is not refreshed. So that next run of Package computes with sam data as first run.
    Where can be a problem?
    Thanks.

    Always use the #<PROJECTCODE>.<VARIABLENAME> syntax.
    Where you want to use the variable in the file name it is best practice to run each iteration of the file load in a separate session. You should take the approach to invoke a scenario with the variable passed in as a parameter for each file to be processed.
    Inside the "child" scenario you should declare the variable (making sure it is a non-persistent type) before you execute the load.
    If you run the scenario synchronously you won't have to change the KMs to make them run in parallel by modifying the temporary table names - conversely, if you change the KMs to use unique table names for the temporary tables (C$, I$) then you will be able to run the scenarios asynchronously and in parallel.

  • 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 --->

  • Hierarchy from flat file loading with errors - duplicate node names

    Hello experts,
    I am loading a product hierarchy from a flat file into a custom hierarchy
    object.  The issue is that it errors out saying I am loading
    duplicates within nodes, however all node IDs within a level are unique.
    It seems to be looking at the node name to determine uniqueness and I know
    we have some duplication within the text there especially when you factor
    in the 32 character limitation for the node name.  Does anyone have an idea
    as to whether it is possible to have it only consider the node ID instead
    of the node name to determine uniqueness?
    A colleague suggested using the link ID to fix this problem but I don't know how that field works or how to populate it.
    I'm working in a BI 7.0 environment (I don't know if that makes a difference since you still have to use the 3.x objects to extract the hierarchy).
    Any help would be appreciated.
    Nancy

    Hi Nancy,
    You may wish to check this OSS Note 1026749 - Hierarchies: Consistency check for duplicate nodes and 912115 (old one)
    Symptom -
    When you load or activate a hierarchy it terminates with error message RH 109 or RH 211. The hierarchy contains duplicate nodes and this is not allowed. The long texts of messages RH 109 or RH 211 do not describe the reason for the problem sufficiently or they are partially incorrect.
    There is uncertainty about in which cases duplicate nodes exist in a hierarchy and in which cases duplicate nodes are allowed.
    Hope this helps,
    Bye...
    Naga Timmaraju

  • A simple file server with Arch Linux?

    Hello everyone.
    I had a lucky day to day and was given an old Pentium III based server with 512MB of RAM. I want to set up a server for my house that can basically act as NAS (network attached storage) and stream files to other members of the family's machines. I also want to install rTorrent and be able to download multimedia on to the server. I also wish to be able to access the server from a Windows machine as I would prefer if the server could be headless (no monitor or keyboard/mouse) after the initial installation of ArchLinux.
    Could someone explain how I might go about performing these tasks? I have never used Linux before (other than Ubuntu for web browsing). I am of course comfortable with installing the OS but not sure about how I would set it up like I want.
    Thanks for reading and I look forward to reading your response.

    You can use samba to share the files between the computers (this will work with Windows as well as Linux and Mac OS X).
    As for rTorrent, you can install rTorrent and run it via ssh. However I would recommend deluge. There is a server daemon which you would run on the server. And then a client which you can run on a linux machine (there might even a be a windows version).
    To use a headless server you need (well you don't need, but it is very helpful) to setup ssh. I am not sure what you mean by stream files to other members of the family's machines (share files)?
    Also if you are not all that familiar with linux, be prepared to do some serious reading or maybe look at using something like ubuntu (but you will still have to read). Using arch would be a great way to learn linux more than what you have with ubuntu.

  • Error in Flat file loading with different units

    Hi Gurus,
    I have Quantity and its unit (say CS, DZ and KG etc...) fields in source system. when i transfered into psa using infopackage the error was shown as The error in unit CS is not mentioned in English.
    Could you please tell me what have to do for solving the problem.
    Thanks
    Shrinu

    Hi,
    Sorry, I couldn't understand your answer. I have problem with transaction data not the masterdata. could you please expand your answer as iam bit new to these problems.
    Points will be awarded for your reply.
    Thanks
    Shrinu

  • MimeBodyPart.getFileName() returns file name with directory path.

    Hi
    The documentation says getFileName() returns filename ,not including directory components. But it is returning
    path like Eserv generic/mails/a.html. Can it return a full path in some mail servers?
    Please respond.
    Thanks

    The documentation says getFileName() returns filename ,not including directory components.I think you must be misinterpreting the documentation. Where did you read that?
    The getFileName method returns whatever the sender sent as a file name. The send should
    send only a simple file name, with no directory components, but they can send anything, and
    you should protect against abuse before using such a file name.

  • File Load is not working on Mac but Windows

    Hi i'm developing an app which simply load files (images and sounds) and uses binary data. Application is working fine on Windows, but it raises error on Mac.
    Now i dont own Mac so i cant debug it, I also googled but couldnt find anything close to it.
    Please advise
    Thanks
    PS: Its an AIR APP
    Here are snippets to understand the code
    //browse file
    _loadFile.addEventListener(Event.SELECT, selectHandler);
    _loadFile.browseForOpen(title, typeFilter);
    //selectHandler
    _loadFile.addEventListener(Event.COMPLETE, loadCompleteHandler);
    _loadFile.load();
    //loadCompleteHandler
    //works on windows but TypeError on Mac
    switch(file.type.toLowerCase()){
      case ".mp3":
      var sound:Sound = new Sound();
      sound.loadCompressedDataFromByteArray(file.data, file.data.length);
      fileHandler(sound);
      break;
      case ".jpg":
      case ".png":
      case ".jpeg":
      case ".gif":
       loader = new Loader();
      loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadBytesHandler);
      loader.loadBytes(file.data);
      break;
    //loadBytesHandler
    fileHandler(loader.content);

    I just tried a simple File load test and the type property always traces out null. According to the ASDocs, the type property: "On the Macintosh, this property is the four-character file type, which is only used in Mac OS versions prior to Mac OS X. If the FileReference object was not populated, a call to get the value of this property returns null.".
    Further reading into the FileReference docs, all properties are supposed to be populated once the complete event fires and that is when I ran a trace of the File.type.
    Since the is an AIR app, you might want to consider using the extension property instead to know the file extension to run a switch case against. The ASDocs also say that in reference to Mac's: "You should consider the creator and type properties to be considered deprecated. They apply to older versions of Mac OS.".
    If you choose to use the extension property instead, you don't have to include the "." in your switch statement. The ASDocs do say that "If there is no dot in the filename, the extension is null." So, you may want to run some tests on Windows to make sure that "extension" works. On Mac OS, pretty much every user friendly file (image, movie, document, etc) has a file extension so you shouldn't have any concern of extension returning null on Mac OS.
    You probably got the TypeError on Mac OS because you were trying to run a String method on a null object at the start of the switch statement.
    FileReference.extension

  • Send file sequentially with BPM

    Dear,
    in my scenario that I'm developing I need to read txt files and send them to SAP ECC through Abap Proxy. I need to send file by file to SAP ECC sequentially. That is, I need to read the file "file1.txt" and send to SAP, then read the file "file2.txt" and send it to the ECC and so on.
    How can I do this?
    You can use BPM?
    What are the steps to implement the BPM?
    Regards,
    Sérgio Salomã

    Hi sergio
    Just for this functionality no need to  use BPM , it will degrade performance
    rather you can use simple file adapter with quqlity of service EOIO. for EOIO it will use seperate queue and files will be in oredr
    thanks
    sandeep

  • WLS 9.2.2: JSP recompile for every page load with JAR'ed tag files

    I have a small custom tag library of three tag files. With the server running in development mode and the tag files in a JAR (included in WEB-INF/lib), the server appears to be doing a JSP recompile on every page load. However, it only compiles on the first page load if the tag files are included in WEB-INF/tags (no JAR). Also, running the server in production mode with the JAR'ed tag files avoids the recompile for every page load.
              Is that how the server should behave?
              For whatever it's worth, I'm also using Eclipse 3.3.2 with WTP and WebLogic Server Tools 1.1.2. The server is running the Sun JVM (1.5_10).

    Vikram,
              I went back and created a simple example to test. Below I'm posting the Java source code generated from the two relevant files: index.jsp, and hello.tag.
              __index.java:
              package jsp_servlet;
              import java.io.*;
              import java.util.*;
              import javax.servlet.*;
              import javax.servlet.http.*;
              import javax.servlet.jsp.*;
              import javax.servlet.jsp.tagext.*;
              public final class __index extends weblogic.servlet.jsp.JspBase implements weblogic.servlet.jsp.StaleIndicator {
              private static void _releaseTags(javax.servlet.jsp.tagext.JspTag t) {
              while (t != null) {
              if(t instanceof javax.servlet.jsp.tagext.Tag) {
              javax.servlet.jsp.tagext.Tag tmp = (javax.servlet.jsp.tagext.Tag)t;
              t = ((javax.servlet.jsp.tagext.Tag) t).getParent();
              try {
              tmp.release();
              } catch(Exception ignore) {}
              else {
              t = ((javax.servlet.jsp.tagext.SimpleTag)t).getParent();
              public boolean _isStale(){
              boolean stale = staticIsStale((weblogic.servlet.jsp.StaleChecker) getServletConfig().getServletContext());
              return _stale;
              public static boolean _staticIsStale(weblogic.servlet.jsp.StaleChecker sci) {
              if (sci.isResourceStale("/index.jsp", 1207926672370L ,"9.2.2.0","America/Denver")) return true;
              if (sci.isResourceStale("/null", 1207926783245L ,"9.2.2.0","America/Denver")) return true;
              return false;
              private static void _writeText(javax.servlet.ServletResponse rsp, javax.servlet.jsp.JspWriter out, String block, byte[] blockBytes)
              throws java.io.IOException {
              if (!_WL_ENCODED_BYTES_OK || _hasEncodingChanged(rsp)){
              out.print(block);
              } else {
              ((weblogic.servlet.jsp.ByteWriter)out).write(blockBytes, block);
              private static boolean _hasEncodingChanged(javax.servlet.ServletResponse rsp){
              String encoding = rsp.getCharacterEncoding();
              if ( "ISO-8859-1".equals(encoding) || "Cp1252".equals(encoding) || "ISO8859_1".equals(encoding) || "ASCII".equals(encoding) ){
              return false;
              if (_WL_ORIGINAL_ENCODING.equals(encoding)) {
              return false;
              return true;
              private static boolean WLENCODED_BYTES_OK = true;
              private static final String WLORIGINAL_ENCODING = "ISO-8859-1";
              private static byte[] _getBytes(String block){
              try {
              return block.getBytes(_WL_ORIGINAL_ENCODING);
              } catch (java.io.UnsupportedEncodingException u){
              WLENCODED_BYTES_OK = false;
              return null;
              private final static String wlblock0 ="<!--\n * $Id$\n-->\n \n<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \n\t\t\"http://www.w3.org/TR/html4/loose.dtd\">\n \n";
              private final static byte[] wlblock0Bytes = getBytes( wl_block0 );
              private final static String wlblock1 =" \n \n\t";
              private final static byte[] wlblock1Bytes = getBytes( wl_block1 );
              private final static String wlblock2 ="\n";
              private final static byte[] wlblock2Bytes = getBytes( wl_block2 );
              private final static String wlblock3 ="\n\n<html>\n<head>\n\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\" />\n\n\t<title>Tag File Test</title>\n</head>\n<body> \n\t";
              private final static byte[] wlblock3Bytes = getBytes( wl_block3 );
              private final static String wlblock4 ="\n</body>\n</html>";
              private final static byte[] wlblock4Bytes = getBytes( wl_block4 );
              static private javelin.jsp.JspFunctionMapper jspxfnmap = javelin.jsp.JspFunctionMapper.getInstance();
              public void _jspService(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
              throws javax.servlet.ServletException, java.io.IOException {
              javax.servlet.ServletConfig config = getServletConfig();
              javax.servlet.ServletContext application = config.getServletContext();
              javax.servlet.jsp.tagext.JspTag _activeTag = null;
              Object page = this;
              javax.servlet.jsp.JspWriter out;
              javax.servlet.jsp.PageContext pageContext = javax.servlet.jsp.JspFactory.getDefaultFactory().getPageContext(this, request, response, null, true , 8192 , true );
              response.setHeader("Content-Type", "text/html; charset=ISO-8859-1");
              out = pageContext.getOut();
              javax.servlet.jsp.JspWriter _originalOut = out;
              javax.servlet.http.HttpSession session = request.getSession( true );
              try {;
              response.setContentType("text/html; charset=ISO-8859-1");
              {_writeText(response, out, _wl_block0, _wl_block0Bytes);}
              {_writeText(response, out, _wl_block1, _wl_block1Bytes);}
              {_writeText(response, out, _wl_block2, _wl_block2Bytes);}
              {_writeText(response, out, _wl_block3, _wl_block3Bytes);}
              jsp_servlet._tags.__hello_tag __tag0 = null ;
              int __result__tag0 = 0 ;
              if (__tag0== null )__tag0 = new jsp_servlet._tags.__hello_tag ();
              __tag0.setJspContext(pageContext);
              __tag0.setParent(null);
              activeTag=_tag0;
              __tag0.doTag();
              {_writeText(response, out, _wl_block4, _wl_block4Bytes);}
              } catch (Throwable __ee){
              if(!(__ee instanceof javax.servlet.jsp.SkipPageException)) {
              while ((out != null) && (out != _originalOut)) out = pageContext.popBody();
              releaseTags(activeTag);
              pageContext.handlePageException(__ee);
              __hello_tag.java:
              package jsp_servlet . _tags ;
              import java.io.*;
              import java.util.*;
              import javax.servlet.*;
              import javax.servlet.http.*;
              import javax.servlet.jsp.*;
              import javax.servlet.jsp.tagext.*;
              public final class __hello_tag extends javax.servlet.jsp.tagext.SimpleTagSupport {
              private static void _releaseTags(javax.servlet.jsp.tagext.JspTag t) {
              while (t != null) {
              if(t instanceof javax.servlet.jsp.tagext.Tag) {
              javax.servlet.jsp.tagext.Tag tmp = (javax.servlet.jsp.tagext.Tag)t;
              t = ((javax.servlet.jsp.tagext.Tag) t).getParent();
              try {
              tmp.release();
              } catch(Exception ignore) {}
              else {
              t = ((javax.servlet.jsp.tagext.SimpleTag)t).getParent();
              public static boolean _staticIsStale(weblogic.servlet.jsp.StaleChecker sci) {
              if (sci.isResourceStale("/META-INF/tags/hello.tag", 1207926783175L ,"9.2.2.0","America/Denver")) return true;
              return false;
              protected static final String tagxTagInfo = "-84,-19,0,5,116,0,5,104,101,108,108,111,116,0,29,106,115,112,95,115,101,114,118,108,101,116,46,95,116,97,103,115,46,95,95,104,101,108,108,111,95,116,97,103,116,0,5,101,109,112,116,121,112,112,112,112,119,5,0,0,0,0,3,116,0,10,106,115,112,67,111,110,116,101,120,116,119,1,0,116,0,28,106,97,118,97,120,46,115,101,114,118,108,101,116,46,106,115,112,46,74,115,112,67,111,110,116,101,120,116,113,0,126,0,4,119,1,1,112,119,2,1,0,112,112,116,0,7,106,115,112,66,111,100,121,119,1,0,116,0,36,106,97,118,97,120,46,115,101,114,118,108,101,116,46,106,115,112,46,116,97,103,101,120,116,46,74,115,112,70,114,97,103,109,101,110,116,113,0,126,0,6,119,1,1,112,119,2,1,0,112,112,116,0,6,112,97,114,101,110,116,119,1,0,116,0,31,106,97,118,97,120,46,115,101,114,118,108,101,116,46,106,115,112,46,116,97,103,101,120,116,46,74,115,112,84,97,103,113,0,126,0,8,119,1,1,112,119,2,1,0,112,112,119,4,0,0,0,0,112,112,";
              protected JspContext jspContext ;
              public void setJspContext ( JspContext ctx ){
              super . setJspContext ( ctx );
              java.util.List nested = null ;
              java.util.List atBegin = null ;
              java.util.List atEnd = null ;
              this.jspContext = new javelin.jsp.JspContextWrapper(ctx, nested, atBegin, atEnd, null);
              }public JspContext getJspContext() {
              return this.jspContext;
              private java.io.Writer jspxsout;
              private javax.servlet.jsp.tagext.JspTag _activeTag;
              private static void _writeText(javax.servlet.ServletResponse rsp, javax.servlet.jsp.JspWriter out, String block, byte[] blockBytes)
              throws java.io.IOException {
              if (!_WL_ENCODED_BYTES_OK || _hasEncodingChanged(rsp)){
              out.print(block);
              } else {
              ((weblogic.servlet.jsp.ByteWriter)out).write(blockBytes, block);
              private static boolean _hasEncodingChanged(javax.servlet.ServletResponse rsp){
              String encoding = rsp.getCharacterEncoding();
              if ( "ISO-8859-1".equals(encoding) || "Cp1252".equals(encoding) || "ISO8859_1".equals(encoding) || "ASCII".equals(encoding) ){
              return false;
              if (_WL_ORIGINAL_ENCODING.equals(encoding)) {
              return false;
              return true;
              private static boolean WLENCODED_BYTES_OK = true;
              private static final String WLORIGINAL_ENCODING = "ISO-8859-1";
              private static byte[] _getBytes(String block){
              try {
              return block.getBytes(_WL_ORIGINAL_ENCODING);
              } catch (java.io.UnsupportedEncodingException u){
              WLENCODED_BYTES_OK = false;
              return null;
              private final static String wlblock0 ="\n<center><h1>Hello World</h1></center>";
              private final static byte[] wlblock0Bytes = getBytes( wl_block0 );
              static private javelin.jsp.JspFunctionMapper jspxfnmap = javelin.jsp.JspFunctionMapper.getInstance();
              public void doTag() throws JspException, java.io.IOException {
              javax.servlet.jsp.PageContext pageContext = (javax.servlet.jsp.PageContext) getJspContext();
              javax.servlet.http.HttpServletRequest request = (javax.servlet.http.HttpServletRequest) pageContext.getRequest ();
              javax.servlet.http.HttpServletResponse response = (javax.servlet.http.HttpServletResponse) pageContext.getResponse();
              javax.servlet.http.HttpSession session = pageContext.getSession();
              javax.servlet.ServletContext application = pageContext.getServletContext();
              javax.servlet.ServletConfig config = pageContext.getServletConfig();
              javax.servlet.jsp.JspWriter out = jspContext.getOut();
              javax.servlet.jsp.tagext.JspTag _activeTag = null;
              try {
              {_writeText(response, out, _wl_block0, _wl_block0Bytes);}
              } catch ( Throwable t ){
              if( t instanceof javax.servlet.jsp.SkipPageException )
              {throw (javax.servlet.jsp.SkipPageException)t;}
              if( t instanceof java.io.IOException )
              {throw (java.io.IOException)t;}
              if( t instanceof IllegalStateException )
              {throw (IllegalStateException)t;}
              if( t instanceof javax.servlet.jsp.JspException )
              {throw (javax.servlet.jsp.JspException)t;}
              throw new javax.servlet.jsp.JspException(t);
              finally {
              ((javelin.jsp.JspContextWrapper)jspContext).syncEndTagFile();
              Edited by Stephen Davison at 04/11/2008 9:02 AM

  • Need help with simple file sharing application

    I have an assignment to build a Java File Sharing application. Since I'm relatively new to programming, this is not gonna be an easy task for me.
    Therefore I was wondering if there are people willing to help me in the next few days. I will ask questions in this thread, there will be loads of them.
    I already have something done but I'm not nearly halfway finished.
    Is there a code example of a simple file sharing application somewhere? I didn't manage to find it.
    More-less, this is what it needs to contain:
    -client/server communication (almost over)
    -file sending (upload, download)
    -file search function (almost over)
    -GUI of an application.
    GUI is something I will do at the end, hopefully.
    I hope someone will help me. Cheers
    One more thing, I'm not asking for anyone to do my homework. I will only be needing some help in the various steps of building an application.
    As I said code examples are most welcome.
    This is what I have done so far
    Server:
    package ToJeTo;
    import java.io.*;
    import java.net.*;
    public class MultiServer {
        public static ServerSocket serverskiSoket;
        public static int PORT = 1233;
        public static void main(String[] args) throws IOException {
            try {
                serverskiSoket = new ServerSocket(PORT);
            }catch (IOException e) {
                System.out.println("Connection impossible");
                System.exit(1);
            do {
                Socket client = serverskiSoket.accept();
                System.out.println("accepted");
                ClientHandler handler = new ClientHandler(client);
                handler.start();
            } while(true);
    }Client:
    package ToJeTo;
    import java.io.IOException;
    import java.io.PrintWriter;
    import java.net.*;
    import java.util.Scanner;
    public class MultiClient {
        public static InetAddress host;
        public static int PORT = 1233;
        public static void main(String[] args) {
            try {
                host = InetAddress.getLocalHost();
            }catch (UnknownHostException uhe) {
                System.out.println("Error!");
                System.exit(1);
            sendMessages();
        private static void sendMessages() {
            Socket soket = null;
            try {
                soket = new Socket(host, PORT);
                Scanner networkInput = new Scanner(soket.getInputStream());
                PrintWriter networkOutput = new PrintWriter(soket.getOutputStream(), true);
                Scanner unos = new Scanner(System.in);
                String message, response;
                do {
                    System.out.println("Enter message");
                    message = unos.nextLine();
                    networkOutput.println(message);
                    response = networkInput.nextLine();
                    System.out.println("Server: " + response);
                }while (!message.equals("QUIT"));
            } catch (IOException e) {
                e.printStackTrace();
            finally {
                try{
                    System.out.println("Closing..");
                    soket.close();
                } catch (IOException e) {
                    System.out.println("Impossible to disconnect!");
                    System.exit(1);
    }ClientHandler:
    package ToJeTo;
    import java.io.*;
    import java.net.*;
    import java.util.*;
    public class ClientHandler extends Thread {
        private Socket client;
        private Scanner input;
        private PrintWriter output;
        public ClientHandler(Socket serverskiSoket) {
            client = serverskiSoket;
            try {
            input = new Scanner(client.getInputStream());
            output = new PrintWriter(client.getOutputStream(), true);
            } catch (IOException e) {
                e.printStackTrace();
            public void run() {
                String received;
                do {
                received = input.nextLine();
                output.println("Reply: " + received);
                } while (!received.equals("QUIT"));
                try {
                    if (client != null)
                        System.out.println("Closing the connection...");
                        client.close();
                }catch (IOException e) {
                    System.out.println("Error!");
    }Those three classes are simple client server multi-threaded connection.

    Now the other part that contains the search function looks like this:
    package ToJeTo;
    import java.io.*;
    import java.util.*;
    public class User {
        String nickname;
        String ipAddress;
        static ArrayList<String> listOfFiles = new ArrayList<String>();
        File sharedFolder;
        String fileLocation;
        public User(String nickname, String ipAddress, String fileLocation) {
            this.nickname = nickname.toLowerCase();
            this.ipAddress = ipAddress;
            sharedFolder = new File(fileLocation);
            File[] files = sharedFolder.listFiles();
            for (int i = 0; i < files.length; i++) {
                listOfFiles.add(i, files.toString().substring(fileLocation.length()+1));
    public static void showTheList() {
    for (int i = 0; i < listOfFiles.size(); i++) {
    System.out.println(listOfFiles.get(i).toString());
    @Override
    public String toString() {
    return nickname + " " + ipAddress;
    User Manager:
    package ToJeTo;
    import java.io.*;
    import java.util.*;
    class UserManager {
        static ArrayList<User> allTheUsers = new ArrayList<User>();;
        public static void addUser(User newUser) {
            allTheUsers.add(newUser);
        public static void showAndStoreTheListOfUsers() throws FileNotFoundException, IOException {
            BufferedWriter out = new BufferedWriter(new FileWriter("List Of Users.txt"));
            for (int i = 0; i < allTheUsers.size(); i++) {
                    System.out.println(allTheUsers.get(i));
                    out.write(allTheUsers.get(i).toString());
                    out.newLine();
            out.close();
    }Request For File
    package ToJeTo;
    import java.util.*;
    public class RequestForFile {
        static ArrayList<String> listOfUsersWithFile = new ArrayList<String>();
        Scanner input;
        String fileName;
        public RequestForFile() {
            System.out.println("Type the wanted filename here: ");
            input = new Scanner(System.in);
            fileName = input.nextLine();
            for (User u : UserManager.allTheUsers) {
                for (String str : User.listOfFiles) {
                    if (str.equalsIgnoreCase(fileName))
                        listOfUsersWithFile.add(u.nickname);
        public RequestForFile(String fileName) {
            for (User u : UserManager.allTheUsers) {
                for (String str : User.listOfFiles) {
                    if (str.equalsIgnoreCase(fileName))
                        listOfUsersWithFile.add(u.nickname);
        public static List<String> getAll() {
            for (int i = 0; i < listOfUsersWithFile.size(); i++) {
                //System.out.println("User that has the file: " + listOfUsersWithFile.get(i));
            return listOfUsersWithFile;
    }Now this is the general idea.
    The user logs in with his nickname and ip address. He defines his own shared folder and makes it available for other users that log on to server.
    Now each user has their own list of files from a shared folder. It's an ArrayList.
    User manager class is there to store another list, a list of users that are connected with server.
    When the user is searching for a particular file, he is searching through all the users and their respective files lists. Therefore for each loop inside a for each loop.
    Now the problem is how to connect all that with Client and Server class and put it into one piece.
    GUI should look somewhat like this:

  • Help! (please :) I have a 1GB iPod that's loaded with music for which my computer can no longer find the original files-due to external mass storage crash during recent move. Is there a way to import iPod music back into my iTunes library on computer???

    Help! (please I have a 1GB iPod that's loaded with music for which my computer can no longer find the original files-due to external mass storage crash during recent move. Is there a way to import iPod music back into my iTunes library on computer???

    Or If there is any purchased music then you can try to transfer purchases
    http://support.apple.com/kb/ht1848
    If you're in the US you can reload purchased music
    http://support.apple.com/kb/ht2519

  • Does simple file and folder sharing on an iMac work with OSX Server?

    Hi There
    I wonder if I should install OSX Server on an iMac wher several users work on the same files and folders.
    My question - before I do something I might regret:
    Does simple file and folder sharing on an iMac within several users really work with the help of OSX Server?
    All I want to be able to do:
    Admin creates a new folder1 and gives it read- and write access for user1 and user2.
    User1 creates a subfolder1 in folder1, and a document1 in subfolder1.
    User2 edits document1. Later Admin edits document1.
    All these simple editing of files and folders (and subfolders) within a main folder should be possible. This is not possible now.
    Is everything clear? I'm not a network specialist or something, I just want to give some co-workers access to some data on my computer without problems.

    So what you need are recursive permissions.
    I suggest you create a group and add user1 and user2 to that group. You can name that group whatever you want, but for now i will call it FSUsers
    Execute this in terminal. Replace FSUsers with your new group
    sudo chmod -R +a "FSUsers allow list,add_file,search,add_subdirectory,delete_child,readattr,writeattr,readextat tr,writeextattr,readsecurity,file_inherit,directory_inherit" /Users/Shared/*
    Replace /Users/Shared with the location of your shared folder. Make sure you keep the /* at the end (this allows all subfolders and files to get the same permissions.
    If you need to add people to the share just add them to the FSUsers group, the FSUsers group should should also be allowed in the sharing preferences.

  • Flat File loading Initialize with out Data transfer is disabled in BI 7.0

    Hi experts,
              When loading through flat file in BI 7.0 for Info Package Level Initialization Delta Process with data Transfer is coming by default,but when i want to select Initialization Delta Process without Data transfer is disabled. (in the creation of Data Source (flat file) in the Extraction Tab Delta Process is changed to FIL1 Delta Data (Delta Images).
    please provide me Solution.
    regards
    Subba reddy.

    Hi Shubha,
    For flat file load please go throught he following link:
    http://help.sap.com/saphelp_nw70/helpdata/EN/43/03450525ee517be10000000a1553f6/frameset.htm
    This will help.
    Regards,
    Mahesh

  • File encoded with x264 takes forever to load in Encore CS 5.5

    I use Encore mostly because it takes h.264 video encoded with the x264 compressor, which provides much higher quality than any other compressor. The problem is that these files take forever to load. For example, right now I'm trying to load a video that is about 1 hour and 20 minutes long, encoded at 38 Mbps, and the file is 20.9 GBytes. Now it's 3 PM and I imported this file along with the AC3 file over an hour ago. The Encore process shows as not responding, but when I open the Windows 7 Resource Monitor, in the disk tab it shows that it's reading the video file at a rate of about 45 MB/s, so I didn't kill the Encore process. I know eventually it's going to stop and load the file, but I don't understand why it takes so long. The encoding parameters that I used in x264 are these:
    x264 --level 4.1 --bluray-compat --preset slow --bitrate 38000 --keyint 30 --min-keyint 2 --open-gop --weightp 0 --slices 4 --vbv-bufsize 30000 --vbv-maxrate 40000 --rc-lookahead 40 --tff --output "output" "input"
    This comes from a family video that is 1080 59.94i. This time these two parameters appeared because I selected Blu-ray as the target:  --bluray-compat and --open-gop, which I don't normally use, but still, even when I don't use them, video encoded with x264 takes forever to load. Does anybody here know what could be the problem?

    What's weird is last year I encoded a file that was almost two hours long and Encore took it without trouble, although it was CS5, not 5.5. Since I had kept the avs and bat files, and also the x264.exe from that encode, I brought them into the current working folder and I just modified the file names in the avs and bat files to point to the new avi and encode to the new h264 file. So I encoded this file, I imported it into Encore, and it still hangs. Maybe it was a change from CS5 to 5.1 that introduced a problem. x264 has been certified to be Blu-ray compliant since over a year ago, and I already put this file to a Blu-ray with TSMuxer, since it was a family video and I didn't really need menus, and it plays perfectly fine in my Blu-ray player.
    But I'm sure there must be something, one or two parameters that would make it compatible. For example, after encoding the file again the last time, now I can import it into Encore, and it doesn't stay frozen forever, but it doesn't show me the video and as soon as I try to move the timeline cursor it freezes and doesn't let me do anything for several minutes. So still it's not usable. But it's a change from the first encode where the progress dialog would be there for several hours and do nothing at all.

Maybe you are looking for

  • If statement for calculated column

    Hi, I need to know if its possible to do the following in a calculated column if column1 value => 1 display the name of column1 + the value of column 1 is this possible?

  • Multiple report fields from single physical column.

    Hi Experts, I have a physical table like below. Multiple records for a single customer id. The no of Address_type may increase in future. Customer_id     Address_Type         Address 101                  Primary                   abcdefgh 101        

  • [SOLVED] Getting some annoying additional text after running pacman!

    Take a look: $ sudo pacman -S amarok Password: resolving dependencies... looking for inter-conflicts... Targets (6): libmtp-0.3.7-1.1 qtscriptgenerator-0.1.0-1 taglib-extras-1.0.1-1 liblastfm-0.3.0-4 loudmouth-1.4.3-1 amarok-2.2.1.90-1 Total Download

  • Invoke a FTP "Get File" operation throws java.lang.ClassCastException:

    Hi there, I am working on a very simple sample project that will pull the file from a ftp site. I create a partner link with FTP adpater with "Get File" operation. When I deploy and run the SIMPLE project, it throws the following exception. I am wond

  • MacBook trying to connect wireless printer via A Express

    Am trying to connect my macbook with an existing linksys network to a wireless printer via an Apple Express. The computer seems to reconize the Apple Express but, in following the instructions to use the Printer Setup Utility to get the computer to r