Intermedia / PHP direct upload

Is it possible to insert an object directly into intermedia from a PHP script? for example:
$statement = oci_parse($conn, 'insert into images (id,image) values (seq.nextval, :uploaded_file' );
$result = oci_execute($statement);I ask because all the upload examples I have seen are file system (directory) based, or http import. We are developing an application where the database will not have access to the web server file system, and we do not want to stage the files on the web server for the database to request via http.
Thanks on advance for any help.
* Since I asked this I found Help with transferring images to interMedia table which is probably where this conversation belongs.
Message was edited by:
user533956

Also From the book "Oracle 10g Developing Media Rich Applications" http://www.amazon.com/Oracle-Developing-Media-Rich-Applications/dp/1555583318/sr=1-1/qid=1168611482/ref=sr_1_1/104-3506528-3471138?ie=UTF8&s=books
This is an example of inserting a media item into the database using ASP .Net. with ODP.NET
First the web form WebForm1.aspx:
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="uploadDB.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
     <HEAD>
          <title>WebForm1</title>
          <meta content="Microsoft Visual Studio 7.0" name="GENERATOR">
          <meta content="C#" name="CODE_LANGUAGE">
          <meta content="JavaScript" name="vs_defaultClientScript">
          <meta content="http://schemas.microsoft.com/intellisense/ie3-2nav3-0" name="vs_targetSchema">
     </HEAD>
     <body>
          <form id="Form1" method="post" encType="multipart/form-data" runat="server">
               <P> </P>
               <P>
                    <TABLE id="Table1" height="119" cellSpacing="1" cellPadding="1" width="744" border="1">
                         <TR>
                              <TD width="141"><asp:label id="Label1" runat="server">Description of Picture: </asp:label></TD>
                              <TD>
                                   <P><asp:textbox id="Description" runat="server" Columns="50"></asp:textbox><asp:requiredfieldvalidator id="RequiredFieldValidator1" runat="server" Width="237px" ControlToValidate="Description" ErrorMessage="You must Enter a picture description"></asp:requiredfieldvalidator></P>
                              </TD>
                         </TR>
                         <TR>
                         </TR>
                         <TR>
                              <TD width="141"><asp:label id="Label2" runat="server">Location of Picture: </asp:label></TD>
                              <TD><asp:textbox id="Location" runat="server" Columns="50"></asp:textbox><asp:requiredfieldvalidator id="RequiredFieldValidator2" runat="server" ControlToValidate="Location" ErrorMessage="You must enter a picture Location"></asp:requiredfieldvalidator></TD>
                         </TR>
                         <TR>
                              <TD width="141"><asp:label id="Label3" runat="server">Picture File</asp:label></TD>
                              <TD><INPUT id="mediaFile" type="file" size="50" runat="server">
                                   <asp:requiredfieldvalidator id="RequiredFieldValidator3" runat="server" Width="136px" ControlToValidate="mediaFile" ErrorMessage="File must be entered" Height="15px"></asp:requiredfieldvalidator>
                              </TD>
                         </TR>
                    </TABLE>
               </P>
               <P><asp:button id="Button1" runat="server" Text="Upload Picture"></asp:button></P>
               <P><asp:label id="StatusLabel" runat="server" Visible="False"></asp:label></P>
          </form>
     </body>
</HTML>The cs code behind the web form WebForm1.aspx.cs:
using System;
using System.Configuration;
using System.IO;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
namespace uploadDB
     /// <summary>
     /// Summary description for WebForm1.
     /// </summary>
     public class WebForm1 : System.Web.UI.Page
        protected System.Web.UI.WebControls.TextBox Description;
        protected System.Web.UI.WebControls.Label Label2;
        protected System.Web.UI.WebControls.TextBox Location;
        protected System.Web.UI.WebControls.Label Label3;
        protected System.Web.UI.HtmlControls.HtmlInputFile mediaFile;
        protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
        protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2;
        protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator3;
        protected System.Web.UI.WebControls.Button Button1;
        protected System.Web.UI.WebControls.Label Label1;
        protected System.Web.UI.WebControls.Label StatusLabel;
        protected static readonly string dbConnectionString =
            ConfigurationSettings.AppSettings["dbConnString"];
          private void Page_Load(object sender, System.EventArgs e)
               // Put user code to initialize the page here
          #region Web Form Designer generated code
          override protected void OnInit(EventArgs e)
               // CODEGEN: This call is required by the ASP.NET Web Form Designer.
               InitializeComponent();
               base.OnInit(e);
          /// <summary>
          /// Required method for Designer support - do not modify
          /// the contents of this method with the code editor.
          /// </summary>
          private void InitializeComponent()
            this.Button1.Click += new System.EventHandler(this.Button1_Click);
            this.Load += new System.EventHandler(this.Page_Load);
          #endregion
        private void Button1_Click(object sender, System.EventArgs e)
            bool success = false;
            OracleConnection dbConn = new OracleConnection(dbConnectionString);
            dbConn.Open();
            // Start transaction
            OracleTransaction trans = dbConn.BeginTransaction();
            // Get image characteristics
            Stream imgStream = mediaFile.PostedFile.InputStream;
            int imgLength = mediaFile.PostedFile.ContentLength;
            string imgContentType = mediaFile.PostedFile.ContentType;
            string imgFileName = mediaFile.PostedFile.FileName;
            try
                OracleCommand cmd =
                    new OracleCommand(
                      "  insert into photos t values " +
                      "    (photosSeq.nextval, '" + Description.Text + "', " +
                      "     '" + Location.Text + "', ordImage.init(), ordImage.init()) " +
                      "    returning rowid, t.image.getContent() into :rwid, :image",
                      dbConn);
                cmd.Parameters.Add("rwid", OracleDbType.Varchar2, 80).Direction =
                    ParameterDirection.Output;
                cmd.Parameters.Add("image", OracleDbType.Blob).Direction =
                    ParameterDirection.Output;
                cmd.ExecuteNonQuery();
                OracleString rowid = (OracleString)cmd.Parameters["rwid"].Value;
                OracleBlob imageBlob = (OracleBlob)cmd.Parameters["image"].Value;
                // Copy the blob from the net (max 2 gig, due to .NET interface)
                byte[] buf = new byte[imageBlob.OptimumChunkSize*8];
                int num;
                int total = 0;
                do
                    num = imgStream.Read(buf, 0, buf.Length);
                    imageBlob.Write(buf, 0, num);
                    total += num;
                } while (total < imgLength);
                OracleCommand procCmd =
                    new OracleCommand(
                       "Declare " +
                       "  img ordImage; " +
                       "  thumbnail ordImage; " +
                       "Begin \n" +
                       "  Select image, thumb into img, thumbnail " +
                       "     from photos where rowid = :rowid for update; "+
                       "  img.setMimeType(:mimetype); \n" +
                       "  Begin " +
                       "    img.setProperties(); \n" +
                       "    img.processcopy('fileformat=JFIF maxscale=128 128', thumbnail);" +
                       "    Exception \n" +
                       "      when others then thumbnail := null;" +
                       "  end; " +
                       "  update photos set image=img, thumb=thumbnail where rowid = :rowid; " +
                       "End; ", dbConn);
                procCmd.Parameters.Add("rowid",
                    OracleDbType.Varchar2,ParameterDirection.Input).Value=rowid;
                procCmd.Parameters.Add("mimetype",
                    OracleDbType.Varchar2,ParameterDirection.Input).Value=imgContentType;
                procCmd.ExecuteNonQuery();
                trans.Commit();
                StatusLabel.Text = "Upload sucessful";
                StatusLabel.Visible = true;
                success = true;
            catch(OracleException ex)
                trans.Rollback();
                StatusLabel.Text = "Upload failed. <br>" + ex.Message;
                StatusLabel.Visible = true;
            finally
                // Close connection (release connection to pool)
                dbConn.Close();
            // Make it that the fields are cleared on suceess
            if (success)
                Response.Redirect("webform1.aspx");
}

Similar Messages

  • Php file upload processing

    Hi I have been working with javascript and php to upload files. I am having problems with
    the backend of the file upload.
    So when the file is recieved in the backend.php . It comes like:
    $fileupload=$_POST['upload_file'];
    The above $fileupload is the url of the file:
    I am trying to extract name , type and size using:
    $name=$_FILE['$fileupload']['name'];
    $tmp_name=$_FILE['$fileupload']['tmp_name'];
    $size=$_FILE['$fileupload']['size'];
    But this seems not to work.
    echo $fileupload; //gives me the file url.
    but:
    echo $name or $tmp_name or $size
    does not work.
    Can any one help.

    Hi Rob
    Thanks so much for the replay. $name=$_FILES['photofield']['name'];
    does not work in this circumstance because I am recieving the file through the ajax code below:
    <script type="text/javascript">
       // JavaScript Document
    var phototitle;
    var photogenre;
    var photodesc;
    var photofield;
    function AjaxStuff(){
    phototitle = jQuery("#phototitle").attr("value");
    photogenre = jQuery("#photogenre").attr("value");
    photodesc = jQuery("#photodesc").attr("value");
    photofield = jQuery("#photofield").attr("value");
    jQuery.ajax({
      type: "POST",
      url: "Uploadfix.php",
      cache: false,
      dataType: "html",
      data: "phototitle=" + phototitle + "&photogenre=" + photogenre + "&photodesc=" + photodesc + "&photofield=" + photofield,
      success: function(response){
       // if sucessful; response will contain some stuff echo-ed from .php
      // alert("Here is your response: " + response);
       // Append this response to some <div> => let's append it to div with id "serverMsg"
       jQuery("#allresult").append(response);
       jQuery("#contentgrid").trigger("reloadGrid");});
    } // END OF FormAjaxStuff()
    </script>
    photofield is the file. Uploadfix.php is where the data is posted:
    Uploadfix.php
    $phototitle=$_POST['photofield];
    the for file:
    $photo=$_FILES['photofield']['name'];
    echo $photo; //Nothing comes out.
    echo $photofield; //The url for the file appears.

  • Routing - Direct upload via LSMW

    Hello all,
    Am using direct upload program RCPTRA02 to upload routings via LSMW.
    I am uploading headers, operations and material assignments. I keep coming across the following error:
    C\ 001                                               
       No header alternative for specified object exists 
    Anyone got any idea as to what this relates to/means?
    Many thanks.

    Hi Kruna,
    I am having the same issue. I am working on SAP ECC 6.0.
    Thanks in advance
    Atul Bhardwaj

  • Flex and php file uploader cross browser problems

    Hi, I have a problem in flex and php file uploader. It was
    working fine in Internet Explorer, but nothing would work in
    Firefox and in other browsers. Firefox and other browsers was not
    sending the session with the file upload and was producing a login
    error. On IE the session cookie is picked up and the upload request
    uses the authenticated session, no login error. I'm newbie in flex.
    Please help me. Thanks in advance!
    Here's my code:
    bgupload.mxml

    Hello, I am Gamaliel Arredondo, i have solved this problem, the error is in the code, you have a mistake in your code, check it out.
    The way to run the flex applications, in my case, i installed xampp, in the htdoc directory i put the folder with the files of the application and all is working very well, only when the apache is running because if it is stoped the application show error, please review your code and if you have problems you can contact me by e-mail ([email protected]) i also fought with that problem but i could find the solution, i hope to help you.

  • Adobe toolbox vs PHP pure upload?

    Been using MX 2004 and enjoyed the PHP pure file upload
    behavior.
    Now downloaded the trial version of DW CS3 and find that my
    file upload behavior wont work, then downloaded the toolbox and
    find that it's so much more different than my usual way of
    uploading files.
    What about the sites that I have developed before with the
    PHP file upload behavior?
    Would I now need to redo every site?
    Cheers

    >>
    What about the sites that I have developed before with the
    PHP file upload behavior?
    Would I now need to redo every site?
    >>
    As the Developer Toolbox "file upload" behaviour uses some
    proprietary methods
    (that certainly applies to the PHP file upload behavior as
    well), you would indeed have to create new file upload pages.
    Was just looking at the "Pure PHP Upload 2" page (
    http://www.dmxzone.com/ShowDetail.asp?NewsId=4509),
    and the specs claim that it´s compatible with Dreamweaver
    CS3

  • As of feb 12th i can no longer directly upload a picture to my facebook profile page from my camera app (iphone5) it goes to an IOS album instead. is this a software glitch? i have had my phone since dec 2012

    as of feb 12th i can no longer directly upload a picture to my facebook profile page from my camera app (iphone5) it goes to an IOS album instead. is this a software glitch? i have had my phone since dec 2012

    Hi there,
    You're running an old version of Safari. Before troubleshooting, try updating it to the latest version: 6.0. You can do this by clicking the Apple logo in the top left, then clicking Software update.
    You can also update to the latest version of OS X, 10.8 Mountain Lion, from the Mac App Store for $19.99, which will automatically install Safari 6 as well, but this isn't essential, only reccomended.
    Thanks, let me know if the update helps,
    Nathan

  • Can I directly upload video from my HDR-SR11 SONY to Premiere Pro???

    Can I directly upload video from my HDR-SR11 SONY to Premiere Pro???

    thank you Shoot.  I was afraid that the n word would answer that querie.  OK.  Please recommend a FREE software that I can use to import on to the hard drive that is reliable and w/out error messages e.g. "Browser will close" as in sonys PMH a new replacement for PMB that fails horribly.  I uninstalled and installed the Sony  PMH four or five times w/Sony "Techs" [I you want to call them that].  And they admitted that the software has problems.  The final solution from the "tech" on the phone was that to just keep on uninstalling and install until it worked.  Wow!  That coming from Sony the electronics Giant.  Below is the transcript of one of the chats concerning this issue.  
    3:37 PM  Connected. A support representative will be with you shortly.
    3:38 PM  Support session established with Angie (C70I).
    3:38 PM 
    Angie (C70I):
    Hello! Welcome to Sony Online Support. My name is Angie.
    3:38 PM 
    Customer:
    GLAD to see you
    3:38 PM 
    Customer:
    same problem
    3:39 PM 
    Customer:
    browser will close error
    3:39 PM 
    Customer:
    I was in settings this time when it froze and closed
    3:39 PM 
    Angie (C70I):
    I understand that when you run 'PMH' you get an error as 'Browser stopped working'.
    3:40 PM 
    Customer:
    es
    3:40 PM 
    Customer:
    yes
    3:40 PM 
    Angie (C70I):
    Thank you for confirming.
    3:40 PM 
    Customer:
    hmmm
    3:41 PM 
    Angie (C70I):
    Well, based on the information you have provided seems that issue can be with operating system.
    3:43 PM 
    Angie (C70I):
    As we have solved the issue earlier and worked fine, there can not be a problem with the 'PMH' software.
    3:43 PM 
    Customer:
    "seems" seems very vague
    3:43 PM 
    Customer:
    can I just reinstall the pmbrowser
    3:44 PM 
    Angie (C70I):
    This is the first time we have come across such issue.
    3:44 PM 
    Customer:
    r u saying that PMH does not work w/Windows 7!!!
    3:44 PM 
    Customer:
    you s
    3:45 PM 
    Customer:
    think Sony would be so stupid to eliminate themselves from the market like that??
    3:45 PM 
    Angie (C70I):
    I suggest that you contact your computer manufacturer before you uninstall the software and install 'PMB'.
    3:45 PM 
    Angie (C70I):
    'PMH' is a compatible software for Windows 7.
    3:45 PM 
    Customer:
    So you agree that PMH can not work on my computer as well???
    3:46 PM 
    Customer:
    so make it work
    3:46 PM 
    Customer:
    do you have a supervisor
    3:47 PM 
    Customer:
    check the web it is not the first time this issue has risen
    3:47 PM 
    Customer:
    are you trained

  • Can I upload to Amazon Cloud Storage using the Play Memories Direct Upload app?

    A note in the app manual says you can add network services directly from the Play Memories Apps page, but I don't see anything indicating how.

    Hi kmford,
    Welcome to the Sony Community!
    Currently, the Direct Upload app only support PlayMemories Online and Facebook. To learn  how to upload other network services, I suggest contacting the Sony Entertainment team at http://www.sonyentertainmentnetwork.com/support/home/.
    If my post answers your question, please mark it as "Accept as Solution". Thanks_Mitch

  • I seem to have lost the ability to directly upload a song from Garageband to facebook or e-mail on both my iMac and Macbook.  Any suggestions.

    I seem to have lost the ability to directly upload a song from Garageband to facebook or e-mail on both my iMac and Macbook.  Any suggestions?

    Have you repaired permissions and restarted your computer after installing ML?  Checked your printer settings in System Preferences?
    If Software Update does not list any updated drivers for your model printer, you should go to the printer's manufacturer website and download the drivers from there and/or contact their tech support to determine if your printer is compatible w/ML.
    Read the various Knowledge Base ML printing articles.  Here are a few to get you started: 
    OS X Mountain Lion: If the software for your printer can’t be found
    OS X Mountain Lion: Troubleshoot a USB printer
    OS X Mountain Lion: Troubleshoot an AirPort printer
    If none of the above work, post back w/the model of your printer and how it's connected to your computer.  USB?  Wireless?

  • Muse creates .php files instead .html files when directly uploaded on host in program

    When i use reCaptcha in Adobe Muse it creates index.php files when i click upload on ftp host. If i export it as html, then it works correctly.
    For my own Website it's not a problem (Hoststar.ch), but it appears to be a problem for other hosting providers (Genotec.ch).
    Also if there is a .htdocs file in the folder im exporting it to, it writes a "Muse Generated redirects", but it still won't for Genotec.ch.
    If there is no .htdocs file in the folder, it also won't create one.
    Is that problem fixable or what do i need to do?

    Hi,
    Adobe Muse does not generates .htdocs file. Did you check it with your host, if it is available for you on the server?

  • Fatal error on php image upload

    I'm trying to test a popular CMS system on my mac and I'm getting the following error when trying to upload a single image.
    Fatal error: Allowed memory size of 10485760 bytes exhausted (tried to allocate 7776 bytes) in /Library/WebServer/Documents/FlashModX/assets/snippets/maxigallery/watermark/Th umbnail.class.php on line 183
    My php.ini settings are:
    memory 128
    post max size 8
    upload max filesize 2m
    max execution time 30
    max input time -1
    what do I need to change?

    thanks for googling. You know I did google and found something similar and did try to add the init to my php file but it really did not work. I was up to 80m which seems a bit much when trying to load a single 480kb file. This is why I posted here in the mac discussions.
    I normally trust the information that I get here and not necessarily from google results.

  • Direct upload to iBooks or use Smashwords

    I've self-published and uploaded my book ("Menopause in Manhattan") to amazon and barnes and noble. Now its time for Apple! Not sure if I should upload directly to iBooks or use Smashwords. Any advice out there? Thanks!

    Hmm, not very good at marketing, more technical.
    Off the top of my head:
    I see you have a web site, terrific. Could you add an interactive blog? Could you add video clips to your Amazon Author Page and Youtube and your website?
    Add all your great reviews to your own web site.
    Could you identify email addresses for your potential target audience and email them?
    Do what you have to do to get more than the single review on Amazon.co.uk.
    Could you advertise on goodreads.com?
    Can you get anyone to interview you and put that on your blog/web site?
    Is there a sequel or a likelihood of one? Tell people about it. I think many of us like to think there will be more of a godd thing!
    That's it I'm signing off!

  • PHP image upload to SERVER

    Hi, I had create a upload picture into the server.It is able
    to work on the WAMP server and upload successfully. However, I
    faced some error when I upload into the server.
    Warning: copy(): open_basedir restriction in effect.
    File(/images/uploaded/1221651842.jpg) is not within the allowed
    path(s):
    (/var/www/vhosts/sppa.org.sg/subdomains/istaff/httpdocs:/tmp) in
    /var/www/vhosts/sppa.org.sg/subdomains/istaff/httpdocs/editImage.php
    on line 138
    Warning: copy(/images/uploaded/1221651842.jpg): failed to
    open stream: Operation not permitted in
    /var/www/vhosts/sppa.org.sg/subdomains/istaff/httpdocs/editImage.php
    on line 138
    Can anybody please help?
    Thanks a million!

    Hi, I had create a upload picture into the server.It is able
    to work on the WAMP server and upload successfully. However, I
    faced some error when I upload into the server.
    Warning: copy(): open_basedir restriction in effect.
    File(/images/uploaded/1221651842.jpg) is not within the allowed
    path(s):
    (/var/www/vhosts/sppa.org.sg/subdomains/istaff/httpdocs:/tmp) in
    /var/www/vhosts/sppa.org.sg/subdomains/istaff/httpdocs/editImage.php
    on line 138
    Warning: copy(/images/uploaded/1221651842.jpg): failed to
    open stream: Operation not permitted in
    /var/www/vhosts/sppa.org.sg/subdomains/istaff/httpdocs/editImage.php
    on line 138
    Can anybody please help?
    Thanks a million!

  • PHP image upload

    Hi, sorry for posting this here but I'm having a hard time
    finding an answer via search engines. Maybe I just don't know what
    criteria to search for. Here's what I'm trying to accomplish:
    Form (Flash or HTML) that enables a user to choose an image
    file, upload it and have a PHP script append the image file name to
    an existing XML file for use in my .swf
    I am just getting involved in PHP and find it very useful but
    I am having the worst time searching for help! This forum is the
    greatest and I hope someone here knows a link or something to point
    me to.
    Many thanks...

    thanks for googling. You know I did google and found something similar and did try to add the init to my php file but it really did not work. I was up to 80m which seems a bit much when trying to load a single 480kb file. This is why I posted here in the mac discussions.
    I normally trust the information that I get here and not necessarily from google results.

  • Is there a plug in for direct upload of photos to Picasa?

    is there a plug in for uploading aperture photos to Picasa web albums?

    There used to be a plug-in, but it has been discontinued - it is still available for download at mirror sites (by Softpedia: http://mac.softpedia.com/progDownload/Aperture-Picasa-Plugin-Download-50358.html ), but since it is a 32-bit version, it is not compatible with Aperture 3.3; the new Aperture version is 64-bit only.
    Regards
    Léonie

Maybe you are looking for

  • Help with Java function

    Hi all, I am suppose to write a java function for the following source and target structure: <u>Source Structure</u> Root A (0..unbounded)   |_ A Root B (0..unbounded)   |_ B Root C (0..unbounded)   |_ C <u>Target Structure</u> Root_target (0..unboun

  • TS3745 What do I do with the import folder once it is on my desktop? Can I delete it?

    I followed the advice to stop getting the "6 pictures were found and not imported message."  I moved the import file in my iPhoto folder to the desktop. Now what do I do with the folder, can I delete it?

  • Movement type from unrestricted to reserved

    Hi Friends, Is there a T-code for stock transferring from unrestricted to reserved? Here is the scenario, we have 100 pieces of material ABC under unrestricted , we'd like to reserve 50 pieces for a particular customer who will place the order two mo

  • Resource Breaks When Upgrade from SQL Server 2000 to 2005 - Help!

    I have a resource that connects to mutiple databases: <ResourceAttribute name='Databases' displayName='com.waveset.adapter.RAMessages:RESATTR_DATABASES' description='com.waveset.adapter.RAMessages:RESATTR_DATABASES_HELP' multi='true'> <value>dbOne</v

  • Sql2005Sp4 x64 (9.0.5000) SqlDump (Access violation) occurs every second

    i am getting around 10 dumps a second.  The dump analysis is below.  It looks like Service Broker may be involved.  We do use service broker so that is a possibility. Can anyone read this and make more sense out of it?  Is there another command i can