Import applications or Upload images issue

Running Oracle 9.2.04 database on redhat AS server and htmldb 2.0.
Export application to redhat server file, then try to import the application on same db instance and server. The next screen I receive has the following message.
The requested URL /pls/htmldbp/wwv_flow.accept was not found on this server.
Same message when I try to upload file. any ideas or things to look for is appreciated.
Troy

i wished it was a simple as that.
Here is the first part of my DAD, I left this out in the earlier post.
[WVGATEWAY]
defaultDAD = simpledad
administrators = all
adminPath = /admin_/
;upload_as_long_raw =
;upload_as_blob =
;debugModules =
[DAD_simpledad]
connect_string = sample-tcp
password = sample
username = sample
default_page = sample.home
document_table = sample.wwdoc_document
document_path = docs
document_proc = sample.wwdoc_process.process_download
upload_as_long_raw =
upload_as_blob = *
reuse = Yes
connmax = 10
enablesso = No
;pathalias =
;pathaliasproc =
;name_prefix =
;always_describe =
;after_proc =
;before_proc =
;

Similar Messages

  • Application to upload image

    hey i need to write an application to allow user to upload images from their desktop onto the server machine? can anyone tell me how to go about doing it? thanks in advance...

    MyFaces has an upload component . For details see "features" at http://myfaces.sourceforge.net.
    regards, thomas

  • OO/Framework, Uploading Images Issue

    I am using using a form that uploads a file. If I use a self
    calling form
    that
    reinitializes the form values from the bean cfc, my field
    contatining the
    image no longer recognizes it as an image and the
    cffile fails.
    <cfif isdefined('form.staffid')>
    <cfoutput> in isdefined staff </cfoutput>
    <cfset staffmember = createobject('component',
    'datafoo.cfc.staff').init(form)>
    <!--- check for errors before saving --->
    <cflock name="photolock" timeout="30">
    <cffile action= "upload"
    filefield='staffmember.filetoupload'
    destination="#expandpath(arguments.directory)##staffmember.filename#"
    nameconflict="makeunique">
    </cflock
    </cfif>
    I get the error: The form field staffmember.filetoupload did
    not contain a
    file.
    However, if I take that form and instead of recreating the
    instance from the
    bean.init,
    just run the upload using the form variable, the image gets
    uploaded fine
    <cfif isdefined('form.staffid')>
    <cfoutput> in isdefined staff </cfoutput>
    <!--- IGNORE <cfset staffmember =
    createobject('component',
    'datafoo.cfc.staff').init(form)> --->
    <!--- check for errors before saving --->
    <cflock name="photolock" timeout="30">
    <cffile action= "upload"
    filefield='file.filetoupload' <!--- *** use form var here
    works --->
    destination="#expandpath(arguments.directory)##form.filename#"
    nameconflict="makeunique">
    </cflock
    </cfif>
    Any suggestions?
    In the bean init I have
    <cfcomponent >
    <cfproperty name="filetoupload" type="string"
    default="">
    <cfscript>
    //Initialize the CFC with the default properties values.
    this.filetoupload='';
    </cfscript>
    <cffunction name="init" output="false"
    returntype="staff">
    <cfargument name="stValues" required="no"
    type="struct">
    <cfif isdefined('arguments.stValues')>
    <cfset this.filetoupload =
    arguments.stValues.filetoupload>
    <cfreturn this>
    </cffunction>
    </component>
    Any suggestions?
    Tami Burke
    Honey House Web Designs

    Yep, got that too. This is an old application that I am
    rewriting during a
    'facelift' project so the forms
    all exist and work.
    I am using the Beans/Dao/Gateway that is originally created
    in CFEclipse and
    customizing to manage
    validation other custom issues.
    The bean sets the original variable using cfproperty tag
    <cfproperty name='filenamehere' type='string'
    default=''>
    Then in the init( obj ) function, the form structure is
    passed into the init
    function (as obj structure) and the
    this.filenamehere variable is loaded from the form.
    <cfscript>
    this.filenamehere =...;
    </cfscript>
    This is where I have attempted putting the form variable
    containing the
    file. I have tried it as
    this.filenamehere = obj.filenamehere; <-- no good
    this.filenamehere = '#obj.filenamehere#'; <-- no good
    this.filenamehere='obj.filenamehere' <-- no good
    <sigh>
    Tami
    "Daverms" <[email protected]> wrote in
    message
    news:gnu295$q52$[email protected]..
    | Hi Tami,
    |
    | Please check your <form> tag and make sure it has the
    enctype attribute
    set to,
    |
    | "enctype= "multipart/form-data"
    |
    | HTH

  • Can I upload images to an application in user mode

    Can I upload images to an application in user mode and make these images available in the server (in the IMAGES folder) -I mean not in Developing mode by openning the application and upload images to shared components-
    I saw the it's done in the Sample Application but I think it's complicated and ........... didn't get it.

    There's the chapter How to Upload and Download Files in an Application in the Advanced Tutorials. Worked for me, but took me some time.
    C.

  • Upload image in Dynamic Region

    Hello.
    Excuse me. my English is not very good.
    I use Jdeveloper 11.1.1.3.0
    in my application i have 2 Bounded Task Flow and i use them as a dynamic region.
    in each bounded task flow i use InputFile component to upload image. but i can't upload image, because when i click the Browse button and select the image, then i click another button in my application to upload image, but the InputFile component value reset . I don't know why this happen.
    this problem just happen in dynamic region, in another case I don't have any problem with upload image.
    Thanks.

    Habib,
    Welcome to OTN.
    As you said you are using taskflows as region, can you check the refresh condition of the region binding in the pagedef and see if that has anything to do with this?
    -Arun

  • Apex upgrade t0 4.1 from 3.2...Upload image is giving error

    Hello
    Please help...
    We recently went from Apex 3.2 to 4.1.
    For few of the applications where upload image is involved, when we upload an image file and click submit
    we get errors like this:
    is_internal_error: false
    ora_sqlcode: 100
    ora_sqlerrm: ORA-01403: no data found
    component.type: APEX_APPLICATION_PAGE_PROCESS
    component.id: 17555821215557266
    component.name: UPLOAD IMAGE
    error_backtrace:
    ORA-06512: at line 27
    ORA-06512: at "SYS.DBMS_SYS_SQL", line 1926
    ORA-06512: at "SYS.WWV_DBMS_SQL", line 966
    ORA-06512: at "SYS.WWV_DBMS_SQL", line 992
    ORA-06512: at "APEX_040100.WWV_FLOW_DYNAMIC_EXEC", line 649
    ORA-06512: at "APEX_040100.WWV_FLOW_PROCESS", line 129
    For some others error messages are like "save image id missing' file image id missing..
    apex_application_files tables have no data inside.It is blank
    Anyone please help
    thanks
    kp

    Hi user12128153 (a real name would be nice),
    a few questions for you.
    Do you experience the same errors with firefox? If so install firebug (if you don't have it already) and see if the errors have to do with missing css etc.
    What application server do you use, OHS/Apex Listener etc?
    Kofi

  • How to upload image in MIME repository  from bsp application

    Hi,
    I want to upload Image in MIME repository from my BSP Application. I want to access again or reuse uploaded image later in my BSP application. Can you please help me how to do this?
    I already go through http://help.sap.com/saphelp_nw2004s/helpdata/en/eb/8c683c8de8a969e10000000a114084/frameset.htm.
    but this is not helpful in my case. It only uploads in cache (temporary) not in MIME repository.
    Thanks

    Hi Prashant,
    In Layout...
    <%
    data: icon_save   type string.
    icon_save   = cl_bsp_mimes=>sap_icon( id = 'ICON_SYSTEM_SAVE' ).
    %>
    For using image globally...
    If you need to upload an image to MIME Repos Go to transaction se80> MIME Repository>
    sap->bc->bsp->sap->public->bc->bsp->icons ---> right click on icons folder --> import mime objects
    Regards,
    Anubhav

  • Error while uploading images to SAP Mobile Documents from iPad application using ObjectiveCMIS.

    Hi,
    I am getting the error while uploading images to SAP Mobile Documents from custom iOS(iPad )application using ObjectiveCMIS library.
    My Custom method is as follows:
    - (void)createSalesOrderRouteMapImageInFolder:(NSString*)salesOrderRouteMapFolderId routeMapImageTitle:(NSString *)imageTitle routeMapContent:(NSData *)imageData
        NSInputStream *inputStream = [NSInputStream inputStreamWithData:imageData];
        NSMutableDictionary *properties = [NSMutableDictionary dictionary];
        [properties setObject:[NSString stringByAppendingFileExtension:imageTitle] forKey:@"cmis:name"];
        [properties setObject:@"cmis:document" forKey:@"cmis:objectTypeId"];
        [self.session createDocumentFromInputStream:inputStream
                                           mimeType:@"image/png"
                                         properties:properties
                                           inFolder:salesOrderRouteMapFolderId
                                      bytesExpected:[imageData length]
                                    completionBlock:^(NSString *objectId, NSError *error) {
                                        NSLog(@"Object id is %@",objectId);
                                        if(error == nil) {
                                            [inputStream close];
                                            NSLog(@"Uploading Sales order route map successfully.");
                                            [[NSNotificationCenter defaultCenter] postNotificationName:SaveOrderSuccessNotification object:nil];
                                        } else {
                                            [inputStream close];
                                            NSLog(@"Uploading sales order route map failed.");
                                            [[NSNotificationCenter defaultCenter] postNotificationName:SaveOrderFailedNotification object:error];
                                    } progressBlock:^(unsigned long long bytesUploaded, unsigned long long bytesTotal) {
                                        NSLog(@"uploading... (%llu/%llu)", bytesUploaded, bytesTotal);
    OBjectiveCMIS Method in which i am getting error during upload:
    - (void)sendAtomEntryXmlToLink:(NSString *)link
                 httpRequestMethod:(CMISHttpRequestMethod)httpRequestMethod
                        properties:(CMISProperties *)properties
                contentInputStream:(NSInputStream *)contentInputStream
                   contentMimeType:(NSString *)contentMimeType
                     bytesExpected:(unsigned long long)bytesExpected
                       cmisRequest:(CMISRequest*)request
                   completionBlock:(void (^)(CMISObjectData *objectData, NSError *error))completionBlock
                     progressBlock:(void (^)(unsigned long long bytesUploaded, unsigned long long bytesTotal))progressBlock
        // Validate param
        if (link == nil) {
            CMISLogError(@"Must provide link to send atom entry");
            if (completionBlock) {
                completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeInvalidArgument detailedDescription:nil]);
            return;
        // generate start and end XML
        CMISAtomEntryWriter *writer = [[CMISAtomEntryWriter alloc] init];
        writer.cmisProperties = properties;
        writer.mimeType = contentMimeType;
        NSString *xmlStart = [writer xmlStartElement];
        NSString *xmlContentStart = [writer xmlContentStartElement];
        NSString *start = [NSString stringWithFormat:@"%@%@", xmlStart, xmlContentStart];
        NSData *startData = [NSMutableData dataWithData:[start dataUsingEncoding:NSUTF8StringEncoding]];
        NSString *xmlContentEnd = [writer xmlContentEndElement];
        NSString *xmlProperties = [writer xmlPropertiesElements];
        NSString *end = [NSString stringWithFormat:@"%@%@", xmlContentEnd, xmlProperties];
        NSData *endData = [end dataUsingEncoding:NSUTF8StringEncoding];
        // The underlying CMISHttpUploadRequest object generates the atom entry. The base64 encoded content is generated on
        // the fly to support very large files.
        [self.bindingSession.networkProvider invoke:[NSURL URLWithString:link]
                                         httpMethod:httpRequestMethod
                                            session:self.bindingSession
                                        inputStream:contentInputStream
                                            headers:[NSDictionary dictionaryWithObject:kCMISMediaTypeEntry forKey:@"Content-type"]
                                      bytesExpected:bytesExpected
                                        cmisRequest:request
                                          startData:startData
                                            endData:endData
                                  useBase64Encoding:YES
                                    completionBlock:^(CMISHttpResponse *response, NSError *error) {
                                        if (error) {
                                            CMISLogError(@"HTTP error when sending atom entry: %@", error.userInfo.description);
                                            if (completionBlock) {
                                                completionBlock(nil, error);
                                        } else if (response.statusCode == 200 || response.statusCode == 201 || response.statusCode == 204) {
                                            if (completionBlock) {
                                                NSError *parseError = nil;
                                                CMISAtomEntryParser *atomEntryParser = [[CMISAtomEntryParser alloc] initWithData:response.data];
                                                [atomEntryParser parseAndReturnError:&parseError];
                                                if (parseError == nil) {
                                                    completionBlock(atomEntryParser.objectData, nil);
                                                } else {
                                                    CMISLogError(@"Error while parsing response: %@", [parseError description]);
                                                    completionBlock(nil, [CMISErrors cmisError:parseError cmisErrorCode:kCMISErrorCodeRuntime]);
                                        } else {
                                            CMISLogError(@"Invalid http response status code when sending atom entry: %d", (int)response.statusCode);
                                            CMISLogError(@"Error content: %@", [[NSString alloc] initWithData:response.data encoding:NSUTF8StringEncoding]);
                                            if (completionBlock) {
                                                completionBlock(nil, [CMISErrors createCMISErrorWithCode:kCMISErrorCodeRuntime
                                                                                     detailedDescription:[NSString stringWithFormat:@"Failed to send atom entry: http status code %li", (long)response.statusCode]]);
                                      progressBlock:progressBlock];
    Attaching the logs:
    ERROR [CMISAtomPubBaseService sendAtomEntryXmlToLink:httpRequestMethod:properties:contentInputStream:contentMimeType:bytesExpected:cmisRequest:completionBlock:progressBlock:] HTTP error when sending atom entry: Error Domain=org.apache.chemistry.objectivecmis Code=260 "Runtime Error" UserInfo=0x156acfa0 {NSLocalizedDescription=Runtime Error, NSLocalizedFailureReason=ASJ.ejb.005044 (Failed in component: sap.com/com.sap.mcm.server.nw) Exception raised from invocation of public void com.sap.mcm.server.service.AbstractChangeLogService.updateChangeLog(java.lang.String,boolean) throws com.sap.mcm.server.api.exception.MCMException method on bean instance com.sap.mcm.server.nw.service.NwChangeLogService@4e7989f3 for bean sap.com/com.sap.mcm.server.nw*annotation|com.sap.mcm.server.nw.ejb.jar*annotation|NwChangeLogService in application sap.com/com.sap.mcm.server.nw.; nested exception is: javax.ejb.EJBTransactionRolledbackException: ASJ.ejb.005044 (Failed in component: sap.com/com.sap.mcm.server.nw) Exception raised from invocation of public com.sap.mcm.server.model.ChangeLog com.sap.mcm.server.dao.impl.ChangeLogDaoImpl.findByUserId(java.lang.String) method on bean instance com.sap.mcm.server.dao.impl.ChangeLogDaoImpl@2852b733 for bean sap.com/com.sap.mcm.server.nw*annotation|com.sap.mcm.server.nw.ejb.jar*annotation|ChangeLogDaoImpl in application sap.com/com.sap.mcm.server.nw.; nested exception is: javax.persistence.NonUniqueResultException: More than 1 objects of type ChangeLog found with userId=25f8928e-8ba0-4edd-b08e-43bf6fb78f1a; nested exception is: javax.ejb.EJBException: ASJ.ejb.005044 (Failed in component: sap.com/com.sap.mcm.server.nw) Exception raised from invocation of public com.sap.mcm.server.model.ChangeLog com.sap.mcm.server.dao.impl.ChangeLogDaoImpl.findByUserId(java.lang.String) method on bean instance com.sap.mcm.server.dao.impl.ChangeLogDaoImpl@2852b733 for bean sap.com/com.sap.mcm.server.nw*annotation|com.sap.mcm.server.nw.ejb.jar*annotation|ChangeLogDaoImpl in application sap.com/com.sap.mcm.server.nw.; nested exception is: javax.persistence.NonUniqueResultException: More than 1 objects of type ChangeLog found with userId=25f8928e-8ba0-4edd-b08e-43bf6fb78f1a}
    2015-03-12 04:08:31.634 Saudi Ceramics[4867:351095] Uploading sales order route map failed.

    Hi Sukalyan,
    Have you checked the below links?
    These will give you step by step implementation procedure.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a099a3bd-17ef-2b10-e6ac-9c1ea42af0e9?quicklink=index&overridelayout=true
    http://wiki.sdn.sap.com/wiki/display/WDJava/KmuploadusingWebdynproapplication
    Regards,
    Sandip

  • I have my camera (Canon 5D MARK 2) set to take both JPEG Large and Raw files with each shot. I uploaded the images from the card to my Pro (Aperture 3) and while the import info said 1500 images were uploaded, I can't find the RAW images.  Aperture put ab

    I have my camera (Canon 5D Mark 2) set to take both JPEG Large and Raw files with each shot. I uploaded the images from the card to my Pro (Aperture 3) and while the import info said 1500 images were uploaded, I can't find the RAW images.  Aperture put about 700 images in an untitled project folder, but all the images are the JPEGs.  What am I missing?
    Thanks,
    upsjdris

    Have you checked your "Import" settings for "Raw&Jpeg" pairs in the "Import" panel?
    You can set Aperture to import raw, jpeg, or raw&jpeg.
    If you imported Raw&Jpeg, but have set Aperture to use the Jpeg as original, you will see the imported image as Jpeg image, not as a raw image, even if the raw has also been imported. You can switch between Raw and Jpeg originals for selected images from the Photos menu:
    Photos > Use Raw as original.
    Regards
    Léonie

  • Safari can not upload images newly imported into iPhoto. I have to shutdown iphoto and safari before the latest import of images into iPhoto is found my safari.

    When I want to upload images to facebook on safari - from a NEWLY imported album in iPhoto - Safari can not find the new album in iPhoto. Obviously the most commonly uploaded images are the recent ones. I am uploading them to a facebook page, not my own account - which is not possible from iphoto. So I have to shutdown safari and iphoto and then do the upload again. This has happened me three times now - and - well - its one of those annoying things that windows 95 could have done and super safari can't .... could apple sort this out sometime. Please.

    You'll not get a rebuttal from me. I still run into Wizard of Oz moments.
    Send Apple feedback. They won't answer, but at least will know there is a problem. If enough people send feedback, it may get the problem solved sooner.
    Feedback

  • PDF import images issue

    My question is, I am importing a 23-page PDF with 26 images
    in it. After importing into RH7, the image files are created, but
    most are just gray rectangles with white dotted lines around them.
    Did I import incorrctly? Is this a known bug?
    Thank you.
    Gary Berger
    CenterBeam, Inc.

    We all have Acrobat Professional reader 7.0.
    I guess he has Windows but tried to open the file from his ipad too.

  • Wordpress http error while uploading images with flash

    Hi guys
    I have a problem with my wordpress blog " bollywood wallpapers ". When I try to upload images with defualt wordpress flash uploader I get "http" error.
    I am having this problem from last 5 months.

    Dear Siva,
    that is indeed strange.
    Still don't know if this could be an issue with your NWDS or the PAR itself.
    So let's do 2 tests
    ===============================================
    TEST NR. 1
    Let's try and check the NWDS first by creating a custom PAR.
    Don't worry, it's easy.
    Just open your NWDS and go to the top menu
    File > New > Project
    Inside the popup window that will open please choose
    Portal Application (on the left) and Create a Portal Application Project (on the right)
    Then give any name you would like (no spaces or dots, etc...)
    You now have a Portal project created on NWDS ( you will see a folder on the left side with your project name)
    Click on that folder with your LEFT mouse button and choose EXPORT
    Choose PAR File
    Choose your Project
    Choose a path where you want your PAR file to be saved. (uncheck the deploy PAR file, but check the include the source code).
    And click Finish.
    Now delete the project you have created (by clicking on the folder with your LEFT mouse button again, but chose DELETE project)
    Now you're ready to re-import the PAR file.
    ===============================================
    TEST NR. 2
    Maybe your standard PAR file that you've downloaded doesn't have the source code included or is corrupted.
    Please try to open it with a ZIP program and check what type of structure/files you have there.
    Have you also checked your NWDS log ?
    You could also share here that log, so that I can better help you.
    Kindest Regards
    /Ricardo

  • Can not upload image of larger size in jsf

    i had some issues in file uploading. File uploading is working fine in my local machine and when i am using the www.mywebsite.com:8080/fileUpload.jsf
    but i can not upload images by using the following www.mywebsite.com/fileUpload.jsf
    Ie: without the port. I am using windows server and tomcat 5.5.27
    When i am trying to upload a bigger size image i am getting the following error
    I am using jsf(tomahawk)
    09:10:47,315 ERROR MultipartRequestWrapper:? - Exception while uploading file.
    org.apache.commons.fileupload.FileUploadException: Processing of multipart/form-data request failed. Socket read failed
    at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:384)
    at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:268)
    at org.apache.myfaces.webapp.filter.MultipartRequestWrapper.parseRequest(MultipartRequestWrapper.java:85)
    at org.apache.myfaces.webapp.filter.MultipartRequestWrapper.getParameter(MultipartRequestWrapper.java:181)
    at org.apache.myfaces.context.servlet.RequestParameterMap.getAttribute(RequestParameterMap.java:42)
    at org.apache.myfaces.context.servlet.AbstractAttributeMap.get(AbstractAttributeMap.java:91)
    at org.apache.myfaces.renderkit.html.HtmlResponseStateManager.getTreeStructureToRestore(HtmlResponseStateManager.java:159)
    at org.apache.myfaces.application.jsp.JspStateManagerImpl.getSequenceString(JspStateManagerImpl.java:260)
    at org.apache.myfaces.application.jsp.JspStateManagerImpl.restoreTreeStructure(JspStateManagerImpl.java:230)
    at org.apache.myfaces.application.jsp.JspStateManagerImpl.restoreView(JspStateManagerImpl.java:267)
    at org.apache.myfaces.application.jsp.JspViewHandlerImpl.restoreView(JspViewHandlerImpl.java:231)
    at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:81)
    at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95)
    at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:100)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    at com.zerone.rrs.authentication.AuthenticationFilter.doFilter(AuthenticationFilter.java:100)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
    at org.apache.coyote.ajp.AjpAprProcessor.process(AjpAprProcessor.java:444)
    at org.apache.coyote.ajp.AjpAprProtocol$AjpConnectionHandler.process(AjpAprProtocol.java:472)
    at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1286)
    at java.lang.Thread.run(Unknown Source)

    Never mind . problem solved after i restarted

  • Storing Uploaded Image Path into Mysql

    Hi I am developing a cms and am using the code David gives in his book PHP Solutions,  everything works fine but I can't work out how to extract the uploaded path so that it is stored in my table.
    Help would be really appreciated, I am making good progress in learning the php especially with David's books but am still struggling when it comes to having to customized the code.
    The code for the upload.php is as follows,
    <?php
    class Gp1_Upload{
      protected $_uploaded = array();
      protected $_destination;
      protected $_max = 51200;
      protected $_messages = array();
      protected $_permitted = array('image/gif',
                                    'image/jpeg',
                                    'image/pjpeg',
                                    'image/png');
      protected $_renamed = false;
      public function __construct($path) {
        if (!is_dir($path) || !is_writable($path)) {
          throw new Exception("$path must be a valid, writable directory.");
        $this->_destination = $path;
        $this->_uploaded = $_FILES;
      public function getuploadpath (){
      public function getMaxSize() {
        return number_format($this->_max/1024, 1) . 'kB';
      public function setMaxSize($num) {
        if (!is_numeric($num)) {
          throw new Exception("Maximum size must be a number.");
        $this->_max = (int) $num;
      public function move($overwrite = false) {
        $field = current($this->_uploaded);
        if (is_array($field['name'])) {
          foreach ($field['name'] as $number => $filename) {
            // process multiple upload
            $this->_renamed = false;
            $this->processFile($filename, $field['error'][$number], $field['size'][$number], $field['type'][$number], $field['tmp_name'][$number], $overwrite);   
        } else {
          $this->processFile($field['name'], $field['error'], $field['size'], $field['type'], $field['tmp_name'], $overwrite);
      public function getMessages() {
        return $this->_messages;
      protected function checkError($filename, $error) {
        switch ($error) {
          case 0:
            return true;
          case 1:
          case 2:
            $this->_messages[] = "$filename exceeds maximum size: " . $this->getMaxSize();
            return true;
          case 3:
            $this->_messages[] = "Error uploading $filename. Please try again.";
            return false;
          case 4:
            $this->_messages[] = 'No file selected.';
            return false;
          default:
            $this->_messages[] = "System error uploading $filename. Contact webmaster.";
            return false;
      protected function checkSize($filename, $size) {
        if ($size == 0) {
          return false;
        } elseif ($size > $this->_max) {
          $this->_messages[] = "$filename exceeds maximum size: " . $this->getMaxSize();
          return false;
        } else {
          return true;
      protected function checkType($filename, $type) {
        if (empty($type)) {
          return false;
        } elseif (!in_array($type, $this->_permitted)) {
          $this->_messages[] = "$filename is not a permitted type of file.";
          return false;
        } else {
          return true;
      public function addPermittedTypes($types) {
        $types = (array) $types;
        $this->isValidMime($types);
        $this->_permitted = array_merge($this->_permitted, $types);
      protected function isValidMime($types) {
        $alsoValid = array('image/tiff',
                           'application/pdf',
                           'text/plain',
                           'text/rtf');
          $valid = array_merge($this->_permitted, $alsoValid);
        foreach ($types as $type) {
          if (!in_array($type, $valid)) {
            throw new Exception("$type is not a permitted MIME type");
      protected function checkName($name, $overwrite) {
        $nospaces = str_replace(' ', '_', $name);
        if ($nospaces != $name) {
          $this->_renamed = true;
        if (!$overwrite) {
          $existing = scandir($this->_destination);
          if (in_array($nospaces, $existing)) {
            $dot = strrpos($nospaces, '.');
            if ($dot) {
              $base = substr($nospaces, 0, $dot);
              $extension = substr($nospaces, $dot);
            } else {
              $base = $nospaces;
              $extension = '';
            $i = 1;
            do {
              $nospaces = $base . '_' . $i++ . $extension;
            } while (in_array($nospaces, $existing));
            $this->_renamed = true;
        return $nospaces;
      protected function processFile($filename, $error, $size, $type, $tmp_name, $overwrite) {
        $OK = $this->checkError($filename, $error);
        if ($OK) {
          $sizeOK = $this->checkSize($filename, $size);
          $typeOK = $this->checkType($filename, $type);
          if ($sizeOK && $typeOK) {
            $name = $this->checkName($filename, $overwrite);
            $success = move_uploaded_file($tmp_name, $this->_destination . $name);
            if ($success) {
                $message = "$filename uploaded successfully";
                if ($this->_renamed) {
                  $message .= " and renamed $name";
                $this->_messages[] = $message;
            } else {
              $this->_messages[] = "Could not upload $filename";
    ?>
    The code for my form page is this
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    <body>
    <?php
    //THE FOLLOWING CODE IS FOR THE UPLOADING OF IMAGES AND FILES
    // set the max upload size in bytes
    $max = 51200;
    if (isset ($_POST ['submit']))
                //define the path to the upload folder
                $destination = 'uploads/';
                require_once('classes/Upload.php');
                try {
                    $upload = new Gp1_Upload($destination);
                    $upload->setMaxSize($max);
                    $upload->move();
                    $result = $upload->getMessages();
                } catch (Exception $e) {
                    echo $e->getMessage();
    // END OF UPLOADING OF IMAGES AND FILES
    ?>
    <form id="newvenue" action="" method="post" enctype="multipart/form-data" >
          <?php
               // THIS CODE DISPLAYS ERROR MESSAGES FOR THE FILE UPLOADS
              if (isset($result)){
              echo '<ul>';
              foreach ($result as $message){
                  echo "<li>$message</li>";
              echo '</ul>';
           ?>
      <table id="neweventdisplay" cellpadding="5"  border="0">
        <tr>
      <td></td>
      <td><input type="hidden" name="user_id"  value="" /></td>
      </tr>
      <tr>
      <td></td>
        <td>Organisers Name</td>
        <td><input class="input80px" id="org_name" name="org_name" type="text" /> </td>
      </tr>
      <tr>
      <td></td>
      <td><label for="image">Upload image:</label></td>
      <td><p>
    <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max; ?>" />
    <input type="file" name="image" id="image" />
    </p></td>
    </tr>
      <tr>
      <td></td>
      <td>Details about your upload</td>
      <td><input class="input80px" id="org_uploadcapt" name="org_uploadcapt" type="text"  /></td>
    </tr>
      <tr>
      <td></td>
      <td><input type="submit" name="submit" id="submit" value="upload"></td>
      </tr>
      <tr>
      <td class="heading"> </td>
      <td></td>
      </tr>
    </table>
    </form>
    <prep>
    <?php
    if (isset ($_POST ['submit'])){
        print_r($_FILES);}
        ?>
        </prep>
    </body>
    </html>

    Hi David
    Thank you very much for your help.  I had continued to work on the code and had worked out how to input the image path into the database but it was using the original filename, so when every it is changed it did not work.  The code in my page at that point was the following,
    <?php     // 2. NEW USER REGISTRATION<br />
            include_once ("includes/form_functions.inc.php");
            $max = 100000;
            $destination = 'uploads/';
            // START FORM PROCESSING FOR A NEW REGISTRATION
            if (isset($_POST['submit'])) { // Form has been submitted.
            $errors = array();
            // perform validations on the form data
            $required_fields = array('org_name');
            $errors = array_merge($errors, check_required_fields($required_fields, $_POST));    
            $required_numberfields = array('user_id');
            $errors = array_merge($errors, check_number_fields($required_numberfields, $_POST));
            $fields_with_lengths = array('org_name' => 36, 'org_website' => 100, 'org_contact' => 40,  'org_conemail' => 80, 'org_contel' => 30);
            $errors = array_merge($errors, check_max_field_lengths($fields_with_lengths, $_POST));
            /*Here I am using trim as well as ucwords, this function converts the first letter of each work into a capital letter,  I am using this only on the
            firstname and surname to ensure that the data is how I want it as it is going  into the database,  The better the data is preformated the better the data
            swill be within the database.*/
            $org_name = trim(strtolower(mysql_prep($_POST['org_name'])));
            $org_website = trim(strtolower(mysql_prep($_POST['org_website'])));
            $org_contact = trim(strtolower (mysql_prep($_POST['org_contact'])));
            $org_conemail = trim(strtolower (mysql_prep($_POST['org_conemail'])));
            $org_contel = strtolower (mysql_prep($_POST['org_contel']));
            $userid = $_POST['user_id'];
            $org_uploadcapt = $_POST['org_uploadcapt'];
            $image = $_FILES['image'];
            /*Here is the code that takes the variable captured from the input form and matches it  up with the appropriate field in the database.  An important point with insertion is that  the variables are in the same order as the mysql field names, there will be an error if the number of variables does not match the number of field names.  Note that there is no entry for the user id as this is an auto increment file within mysql and so is not needed to be entered*/
            if ( empty($errors) ) {
                $sql = "INSERT INTO organiser
                          (org_name, org_website, org_contact, org_conemail, org_contel, user_id, org_uploadurl, org_uploadcapt)
                          VALUES
                          ('{$org_name}', '{$org_website}', '{$org_contact}', '{$org_conemail}', '{$org_contel}', '{$userid}', '{$destination}".$image['name']."', '{$org_uploadcapt}' )";
                $result = mysql_query($sql, $connection);
                if ($result) {
                    $message = "The organiser was successfully created.<br />";
                } else {
                    $message = "I am sorry but the organiser could not be added.";
                    $message .= "<br />" . mysql_error();
                } else {
                    /* this counts the number of errors and informs the user of how many fields were
                    incorrectly entered*/
                if (count($errors) == 1) {
                    $message = "There was 1 error in the form.";
                } else {
                    $message = "There were " . count($errors) . " errors in the form.";
        } else { // Form has not been submitted.
            $org_name = "";
            $org_website = "";
            $org_contact = "";
            $org_conemail = "";
            $org_contel = "";
            $userid = "";
            $org_uploadcapt = "";
    //THE FOLLOWING CODE IS FOR THE UPLOADING OF IMAGES AND FILES
    // set the max upload size in bytes
    if (isset ($_POST ['submit']))
                //define the path to the upload folder
                // Use This On The Local Hosting Machine
                //$destination = 'C:/upload_test/';
                // Use This On The Live Server
                require_once('classes/Upload.php');
                try {
                    $upload = new Gp1_Upload($destination);
                    $upload->setMaxSize($max);
                    $upload->move();
                    $result = $upload->getMessages();
                } catch (Exception $e) {
                    echo $e->getMessage();
    // END OF UPLOADING OF IMAGES AND FILES
    ?>
    <title>Horse Events</title>
    <?php include_once("includes/meta.inc.php");?>
    <?php include_once("includes/cssfavgoogle.inc.php");?>
    <link href="css/adminpanel.css" rel="stylesheet" type="text/css" />
    <style>
    input[type="number"] {
        width:40px;
    </style>
    </head>
    <body>
    <div id="wrapper">
        <div id="admincontent">
    <form id="newvenue" action="neworganiser.php" method="post" enctype="multipart/form-data" >
          <?php if (!empty ($message)) {echo "<p class=\"message\">" . $message . "</p>";} ?>
          <?php if (!empty ($errors)) {display_errors($errors); } ?>
          <?php
              // THIS CODE DISPLAYS ERROR MESSAGES FOR THE FILE UPLOADS
              if (isset($result)){
              echo '<ul>';
              foreach ($result as $message){
                  echo "<li>$message</li>";
              echo '</ul>';
           ?>
    <br />
          <table id="neweventdisplay" cellpadding="5"  border="0">
        <tr>
      <td></td>
      <td><input type="hidden" name="user_id"  value="<?php echo $url_userid ['user_id']; ?>" /></td>
      </tr>
      <tr>
      <td> <span class="compuls">*</span></td>
        <td>Organisers Name</td>
        <td><input class="input80px" id="org_name" name="org_name" type="text" />
         </td>
      </tr>
          <tr>
          <td><span class="compuls">*</span></td>
        <td>Their Website</td>
        <td><input class="input80px" id="org_website" name="org_website" type="text" /></td>
      </tr>
        <tr>
        <td><span class="compuls">*</span></td>
        <td>Organisers Contact</td>
        <td><input id="org_contact" name="org_contact" type="text" />eg: Mrs Jean Kelly</td>
      </tr>
        <tr>
        <td><span class="compuls">*</span></td>
        <td>Contact Email</td>
        <td><input class="input80px" id="org_conemail" name="org_conemail" type="text" />
          </td>
      </tr>
        <tr>
        <td><span class="compuls">*</span></td>
      <td>Contact Tel No.</td>
      <td><input id="org_contel" name="org_contel" type="text" /></td>
      </tr>
      <tr>
      <td></td>
      <td><label for="image">Upload image:</label></td>
      <td><p>
    <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max; ?>" />
    <input type="file" name="image" id="image" />
    </p></td>
    </tr>
      <tr>
      <td></td>
      <td>Details about your upload</td>
      <td><input class="input80px" id="org_uploadcapt" name="org_uploadcapt" type="text"  /></td>
    </tr>
      <tr>
      <td></td>
      <td><input type="submit" name="submit" id="submit" value="Add Your Organiser"></td>
      </tr>
      <tr>
      <td class="heading"> </td>
      <td></td>
      </tr>
    </table>
    <a  class="delete" href="controlpanel.php">Cancel</a>
    </form>
        </div>
    I have added the code you kindly forwarded but am getting an error,  I am still trying to learn the basics of php and am unsure of what to do next, my php Upload.php now looks like
    <?php
    class Gp1_Upload{
      protected $_uploaded = array();
      protected $_destination;
      protected $_max = 100000;
      protected $_messages = array();
      protected $_permitted = array('image/gif',
                                    'image/jpeg',
                                    'image/pjpeg',
                                    'image/png');
      protected $_renamed = false;
      protected $_filenames = array();
      public function __construct($path) {
        if (!is_dir($path) || !is_writable($path)) {
          throw new Exception("$path must be a valid, writable directory.");
        $this->_destination = $path;
        $this->_uploaded = $_FILES;
      public function getMaxSize() {
        return number_format($this->_max/100000, 1) . 'kB';
      public function setMaxSize($num) {
        if (!is_numeric($num)) {
          throw new Exception("Maximum size must be a number.");
        $this->_max = (int) $num;
      public function move($overwrite = false) {
        $field = current($this->_uploaded);
        if (is_array($field['name'])) {
          foreach ($field['name'] as $number => $filename) {
            // process multiple upload
            $this->_renamed = false;
            $this->processFile($filename, $field['error'][$number], $field['size'][$number], $field['type'][$number], $field['tmp_name'][$number], $overwrite);   
        } else {
          $this->processFile($field['name'], $field['error'], $field['size'], $field['type'], $field['tmp_name'], $overwrite);
      public function getMessages() {
        return $this->_messages;
      protected function checkError($filename, $error) {
        switch ($error) {
          case 0:
            return true;
          case 1:
          case 2:
            $this->_messages[] = "$filename exceeds maximum size: " . $this->getMaxSize();
            return true;
          case 3:
            $this->_messages[] = "Error uploading $filename. Please try again.";
            return false;
          case 4:
            $this->_messages[] = 'No file selected.';
            return false;
          default:
            $this->_messages[] = "System error uploading $filename. Contact webmaster.";
            return false;
      protected function checkSize($filename, $size) {
        if ($size == 0) {
          return false;
        } elseif ($size > $this->_max) {
          $this->_messages[] = "$filename exceeds maximum size: " . $this->getMaxSize();
          return false;
        } else {
          return true;
      protected function checkType($filename, $type) {
        if (empty($type)) {
          return false;
        } elseif (!in_array($type, $this->_permitted)) {
          $this->_messages[] = "$filename is not a permitted type of file.";
          return false;
        } else {
          return true;
      public function addPermittedTypes($types) {
        $types = (array) $types;
        $this->isValidMime($types);
        $this->_permitted = array_merge($this->_permitted, $types);
      protected function isValidMime($types) {
        $alsoValid = array('image/tiff',
                           'application/pdf',
                           'text/plain',
                           'text/rtf');
          $valid = array_merge($this->_permitted, $alsoValid);
        foreach ($types as $type) {
          if (!in_array($type, $valid)) {
            throw new Exception("$type is not a permitted MIME type");
      protected function checkName($name, $overwrite) {
        $nospaces = str_replace(' ', '_', $name);
        if ($nospaces != $name) {
          $this->_renamed = true;
        if (!$overwrite) {
          $existing = scandir($this->_destination);
          if (in_array($nospaces, $existing)) {
            $dot = strrpos($nospaces, '.');
            if ($dot) {
              $base = substr($nospaces, 0, $dot);
              $extension = substr($nospaces, $dot);
            } else {
              $base = $nospaces;
              $extension = '';
            $i = 1;
            do {
              $nospaces = $base . '_' . $i++ . $extension;
            } while (in_array($nospaces, $existing));
            $this->_renamed = true;
        return $nospaces;
      protected function processFile($filename, $error, $size, $type, $tmp_name, $overwrite) {
        $OK = $this->checkError($filename, $error);
        if ($OK) {
          $sizeOK = $this->checkSize($filename, $size);
          $typeOK = $this->checkType($filename, $type);
          if ($sizeOK && $typeOK) {
            $name = $this->checkName($filename, $overwrite);
            $success = move_uploaded_file($tmp_name, $this->_destination . $name);
            if ($success) {
                $message = "$filename uploaded successfully";
                if ($this->_renamed) {
                  $message .= " and renamed $name";
                $this->_messages[] = $message;
            } else {
              $this->_messages[] = "Could not upload $filename";
      public getFilenames() {
        return $this->_filenames;
    ?>
    The error is Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE.   
    I have not worked with oop before and have only very briefly looked at the principle was on my foundation degree.

  • Upload image into mysql database residing on  remote server is not working?

    hello to all,
    i need ur help,we hav online site .
    i have to upload image(which can b from any pc) into mysql database residing on remote server of which we (don't hav actual path of that server).
    the solution i'm using is working correctly on local bt when transfer it to server it shows
    java.io.FileNotFoundException: (No such file or directory)
    i have used multipartRequest to access parameter of file type input.
    all variables and related packages r imported properly.no prblm in that.
    code is here....................................
    try {
    MultipartRequest multi = new MultipartRequest(request, ".", 500000 * 1024);
    File f = multi.getFile("uploadfile");
    out.println(f.getName());
    filename = f.getName();
    String type = multi.getContentType(f.getName());
    fis=new FileInputStream(filename);
    byte b[]=new byte[fis.available()];
    fis.read(b);
    fis.close();
    Blob blob=new SerialBlob(b);
    Class.forName("com.mysql.jdbc.Driver");
    Connection con=DriverManager.getConnection("jdbc:mysql://10.1.52.206:3306/test?user=root&password=delhi");
    String query="insert into uploads (FILENAME,BINARYFILE,) values (?,?)";
    pstmt=con.prepareStatement(query);
    pstmt.setString(1,filename);
    pstmt.setBlob(2,blob);
    int i=pstmt.executeUpdate();
    if(i>0)
    out.println("Image Stored in the Database");
    else
    out.println("Failed");
    } catch (Exception ex) {
    out.print("*******************"+ex);
    ex.printStackTrace();
    please suggest me the way to upload image to remote server** not on local server.
    its urgent.
    Edited by: JavaDevS on Jul 28, 2008 11:41 AM

    i need ur help,we hav online site .Please don't use these juvenile abbreviations. It's impolite when you're asking for assistance not to make the effort to spell out all of the words. Moreover in a forum with an international readership the use of standard English will reduce the possibility of confusion.
    I presume that your file upload is being placed in a different directory from that which you were expecting. I would suggest logging all paths (specifically filename) to see if this is an unexpected value.
    Please explain further what you mean by "local" - is this a stand-alone application, or merely running a copy of the server on your local machine and doing the transfer (via the browser) to that? Are there any other differences such as the browser used?

Maybe you are looking for