Uploading an image dynamically into Flash

I'd upload an image choosen by the client, but I want to wrap it in a movieclip in order to manipulate its size and color with color transform. How can I do it? (AS3 in Flash 10)
My code:
import flash.display.SimpleButton;
   import flash.net.FileReference;
   import flash.net.FileFilter;
   import flash.events.IOErrorEvent;
   import flash.events.Event;
   import flash.utils.ByteArray;
   import flash.display.*;
   import flash.geom.*;
   var loadFileRef:FileReference;
   const FILE_TYPES:Array = [new FileFilter("Image Files", "*.jpg;*.jpeg;*.gif;*.png;*.JPG;*.JPEG;*.GIF;*.PNG")];
    function loadFile(event:MouseEvent):void {
    loadFileRef = new FileReference();
    loadFileRef.addEventListener(Event.SELECT, onFileSelect);
    loadFileRef.browse();
    function onFileSelect(e:Event):void {
    loadFileRef.addEventListener(Event.COMPLETE, onFileLoadComplete);
    loadFileRef.load();
    function onFileLoadComplete(e:Event):void {
       var loader:Loader = new Loader();
       loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onDataLoadComplete);
       loader.loadBytes(loadFileRef.data);
    loadFileRef = null;
    function onDataLoadComplete(e:Event):void {
    var bitmapData:BitmapData = Bitmap(e.target.content).bitmapData;
    if((bitmapData.height)<=(bitmapData.width))
                var r:Number = bitmapData.height/bitmapData.width;
                var ra:Number = 500*r;
                var matrix:Matrix = new Matrix();
                matrix.scale(500/bitmapData.width, ra/bitmapData.height);
    graphics.clear();
    graphics.lineStyle(1, 0x000000);
    graphics.beginBitmapFill(bitmapData, matrix, false);
    graphics.drawRect(0, 0, 500, ra);
    graphics.endFill();
    } else {
                var d:Number = bitmapData.width/bitmapData.height;
                var da:Number = 500*d;
                var matrix2:Matrix = new Matrix();
                matrix2.scale(500/bitmapData.width, da/bitmapData.height);
    graphics.clear();
    graphics.lineStyle(1, 0x000000);
    graphics.beginBitmapFill(bitmapData, matrix2, false);
    graphics.drawRect(0,50, 500, da);
    graphics.endFill();
  boton.addEventListener(MouseEvent.CLICK, loadFile);
Any help will be very appreciated. Madrid.

If you see the code, I draw a rectangle in order to enclose the bitmapData as a fill. I made it in flex adding the rectangle to a canvas with ID, and then applied the transformations and zooming to the canvas itself successfully. But my client wants some other issues that only can be made in Flash, and I have to transfer the whole code to Flash, For instance, look at both codes and you will grasp what I'm trying to say:
1) Flex:
imageView.graphics.clear();  // "imageView" is the canvas id.imageView.graphics.beginBitmapFill(bitmapData, matrix,false);imageView.graphics.drawRect(0, 0, 500, ra);
imageView.graphics.endFill();
2) Flash:
     graphics.clear();   // you see? There is NOT an instance name. How can I manipulate THIS?
    graphics.lineStyle(1, 0x000000);
    graphics.beginBitmapFill(bitmapData, matrix, false);
    graphics.drawRect(0, 0, 500, ra);
    graphics.endFill();
Thanks a lot for your patience. Madrid.

Similar Messages

  • Why do images brought into flash from a psd appear differently when publish

    I am creating a flash banner using a layered psd.  The account team is happy with the look of the psd. BUT, when I bring the images into flash and publish the file, the colors look different.  I import them into flash at the highest quality yet they don't look the same.  Any advice?

    The answer relates to color spaces (profiles) and color management in Flash.
    In the other creative suite applications you work with a color space to define the colors your using—i.e., if you have #ff0000 full red this will be a different color in sRGB (an RGB color space) than Adobe 1998 (a different RGB color space). You need to have a color space (profile) to make sense of the color values.
    Flash doesn't honor profiles currently, which means it ignores these profiles. By default in Flash Player 10, and the only option in all players before 10, it gives these color numbers to the operating system without a color space, so the operating system is in charge of making sense of these numbers. In Windows it will assume these numbers are in the sRGB color space, on Mac it will assume that these numbers are in the monitor's color space (on my macbook this is Color LCD, which I believe is the color space for all macbooks by default).
    The way to get the colors to look the best in Flash is to make sure that the document is sRGB before you bring it into Flash. In Photoshop you can convert the colors into the sRGB color space, which will change these color values into the sRGB color space, by going to Edit -> Convert to Profile, and find sRGB in the RGB dropdown. Another way to do it if you are saving just a flat image is to use File -> Save For Web & Devices and check the Convert to sRGB checkbox on the right. Now when you bring the image in to Flash and publish it it should look right on Windows, and probably better on Mac.
    Flash Player 10 adds a feature where you can say that all the images are in the sRGB color space and it will hand the color values to the operating system as sRGB numbers. This makes it work better on Mac, if the swf file is viewed in an environment that honors profiles (Mac and Windows honor profiles but most browsers still ignore profiles, but that's getting better). You can turn this feature on by putting this code into your Flash file: stage.colorCorrection = ColorCorrection.ON;. Read more on that at this link: http://blogs.adobe.com/jnack/2008/10/get_better_color_through_fp10.html. I also gave a presentation on color management and blogged about it, which you can read about and watch here: http://blog.elliselkins.com/2009/02/flying-through-color-space-uflash.html.
    Feel free to ask me anything. Hope this helps.

  • Color Shift When Importing JPG Sequence into Flash CS6

    I am importing a jpg sequence into flash that has been exported from After Effects CS6. No matter what I try, the color will shift when the image imports into flash. The sequence originally started out as a vector graphic in Illustrator (color profile set to sRGB IEC61966-2.1) and then imported into After Effects for an animation that I couldn't quite achive in Flash. The color profile in After Effects is also sRGB IEC61966-2.1 with the "Match Legacy" checkbox checked. I export it out of After Effects as a JPG Sequence and then import into Flash. No matter what I try, the bitmap images' color will shift (become dull) when I import. Even when I open the images in Windows Photo Gallery, they look fine - it's only when I import into Flash.  I've also tried PNG and .PSD Sequence with the same result. I've searched around, but still haven't found a solution. Any help is greatly appreciated.

    I am in the midst of trying to figure out the opposite : Flash to After Effects.  I am betting that this is an issue of 'color profile' attached to the images and the gamma settings in that profile.  RGBA is only part of the story - color profile is all the rest of it.  Eye Dropper doesn't tell you the color profile attached to the image.

  • Converting bitmap image sequences to Flash

    Hello,
    I use LightWave 3D to create a set of characters that are
    simple talking heads. Composited in Mirage and edited in VT4, it's
    all bitmap images. You can see a sample here:
    Subversive
    Entertainment
    That version was intended for TV but isn't going to sell. I'd
    like to try it as an animated editorial cartoon embedded in a Flash
    player at online newspapers. But when I compress the video it
    doesn't convert as cleanly as I know a direct Flash file would. I'd
    like to import the image sequences into Flash and converting them
    to symbols(?) or movie clips(?) or(?)...
    What would be the best way to handle the image sequences in
    Flash? They are currently 180 frames long for each character, but I
    could reduce the image sequence to as little as 60 frames. Once the
    image sequence is converted to a set of symbols(?) they would be
    re-used over and over.
    I imported a 180 frame image sequence and it put one image on
    each frame in the Flash timeline. How would I convert that entire
    image seqence to a sequence of symbols(?) that I could re-use. When
    I exported it as a movie it made a .swf file that looks great but I
    don't think that's what I want to work with within Flash. (I'll
    create a differnt background in FLash as well.)
    Whew,
    Hope this made sense.
    TW

    after importing, select the entire range of keyframes
    containing your image sequence. Right-click
    over them and select COPY FRAMES.
    Open Library and create a new symbol.
    PASTE FRAMES into frame 1 of this new symbol.
    On main timeline create a new layer (delete original layer)
    and drg instance of your new symbol to
    it. Now you have a nested animation that can be reused.
    Chris Georgenes / mudbubble.com / keyframer.com / Adobe
    Community Expert
    tomwood2 wrote:
    > Hello,
    >
    > I use LightWave 3D to create a set of characters that
    are simple talking
    > heads. Composited in Mirage and edited in VT4, it's all
    bitmap images. You can
    > see a sample here:
    >
    > www.subversive-entertainment.com
    >
    > That version was intended for TV but isn't going to
    sell. I'd like to try it
    > as an animated editorial cartoon embedded in a Flash
    player at online
    > newspapers. But when I compress the video it doesn't
    convert as cleanly as I
    > know a direct Flash file would. I'd like to import the
    image sequences into
    > Flash and converting them to symbols(?) or movie
    clips(?) or(?)...
    >
    > What would be the best way to handle the image sequences
    in Flash? They are
    > currently 180 frames long for each character, but I
    could reduce the image
    > sequence to as little as 60 frames. Once the image
    sequence is converted to a
    > set of symbols(?) they would be re-used over and over.
    >
    > I imported a 180 frame image sequence and it put one
    image on each frame in
    > the Flash timeline. How would I convert that entire
    image seqence to a sequence
    > of symbols(?) that I could re-use. When I exported it as
    a movie it made a .swf
    > file that looks great but I don't think that's what I
    want to work with within
    > Flash. (I'll create a differnt background in FLash as
    well.)
    >
    > Whew,
    >
    > Hope this made sense.
    >
    > TW
    >

  • Flash image gallery into dreamweaver cs3

    I put a flash image gallery into my web page using dreamweave
    cs3 and every things working but the images from the image gallery
    do not show up. How do I connect the images to the flash file in
    dreamweaver.

    TexasJen posted in macromedia.dreamweaver:
    > When I type in the address: www.jenspaeth.com it opens
    up to the
    > front page
    > of the shell in the browser. It does not work past that
    though.
    > The flash buttons highlight on rollover, but do not do
    anything.
    Getting a 404 error for
    http://www.jenspaeth.com/home.swf
    before I even
    bring a mouse over the screen.
    I'm guessing that
    http://www.jenspaeth.com/Jen
    Site/Shell.swf is
    attempting to load that file and cannot find it.
    Did you upload home.swf and any other relavent files to the
    root of
    www.jenspaeth.com? Or is it supposed to be in the "Jen Site"
    folder?
    You should not use spaces in folder/file names.
    Mark "404" Boyd
    Keep-On-Learnin' :)

  • I am getting a error IO when trying to upload multiple images within wordpress using the flash uploader. I do not get the error when uploading using explorer. The error only appears if I try uploading using firefox....any ideas?

    I am getting a error IO when trying to upload multiple images within wordpress using the flash uploader. I do not get the error when uploading using explorer. The error only appears if I try uploading using firefox....any ideas?

    Logged the call with SAP who directed me to 'Define settings for attachments' in IMG and setting the 'Deactivate Java Applet' & 'Deactivate Attachment versioning' checkboxes - problem solved.

  • Problem in uploading an image into a CM repository!!

    Hi All,
         I am trying to use the Fileupload element in JSP dynpage.
         My screen has the Fileupload element and a button.
         <b>I want to upload an image into a CM repository.</b>
         I have put <hbj:form id="myFormId" encodingType="multipart/form-data" > in my jsp page.
         The <b>'onClick'</b> method is <b>'onLoadFile'</b>.
         <i><b>The following is my code:</b></i>
    public void onLoadFile(Event event)
                   FileUpload fu =
                        (FileUpload) this.getComponentByName("myfileupload");
                   if (fu != null) {
                        //    Get file parameters
                        IFileParam fileParam = fu.getFile();
                        //    Get the temporary file name
                        File f = fileParam.getFile();
                        String fileName = fileParam.getFileName();
                        //    Get the selected file name
                        String ivSelectedFileName = fu.getFile().getSelectedFileName();
                        try {
                             int len = (int) f.length();
                             byte a[] = new byte[len];
                             FileInputStream fin = new FileInputStream(f);
                             fin.read(a);
                             String FileContent = a.toString();
                             IPortalComponentRequest request =
                                  (IPortalComponentRequest) this.getRequest();
                             com.sapportals.portal.security.usermanagement.IUser user =
                                  (com.sapportals.portal.security.usermanagement.IUser) request.getUser().getUser();
                             IResourceFactory factory = ResourceFactory.getInstance();
                             IResourceContext context = new ResourceContext(user);
                             RID rid = RID.getRID("/documents/test");
                             IResource resource = factory.getResource(rid, context);
                             if (resource != null) {
                                  ICollection parent =
                                       (ICollection) ResourceFactory
                                            .getInstance()
                                            .getResource(
                                            rid,
                                            context);
                                  String out = new String(FileContent);
                                  ByteArrayInputStream data =
                                       new ByteArrayInputStream(out.getBytes());
                                  IContent content =
                                       new Content(data, "text/html", data.available());
                                  IResource fileResource =
                                       parent.createResource(fileName, null, content);
                        } catch (Exception e) {
                   <b>..... REMAINING CODE...</b>
    I uploaded <b>abc.jpg (<i>size: 2KB</i>)</b>, then, an image file with the same-name is being created in the <b>/documents/test</b> folder but the size is <b>10Bytes</b> only. <b>I am not able to see the image</b> too.
    Can any1 help me plzzzz??? Would appreciate any kind of help.
    Thanks in advance.
    <b>
    Regards,
    Sai Krishna.</b>

    I would guess that this is because of the way you try to read the file contents. Maybe you should add some debug statements to find out what you're realling setting as content. It's certainly not KM's fault.
    The following sequence of statements looks wrong:
    nt len = (int) f.length();
    byte a[] = new byte[len];
    FileInputStream fin = new FileInputStream(f);
    fin.read(a);
    String FileContent = a.toString();
    IPortalComponentRequest request =
    (IPortalComponentRequest) this.getRequest();
    com.sapportals.portal.security.usermanagement.IUser user =
    (com.sapportals.portal.security.usermanagement.IUser) request.getUser().getUser();
    IResourceFactory factory = ResourceFactory.getInstance();
    IResourceContext context = new ResourceContext(user);
    RID rid = RID.getRID("/documents/test");
    IResource resource = factory.getResource(rid, context);
    if (resource != null) {
    ICollection parent =
    (ICollection) ResourceFactory
    .getInstance()
    .getResource(
    rid,
    context);
    String out = new String(FileContent);
    ByteArrayInputStream data =
    new ByteArrayInputStream(out.getBytes());
    IContent content =
    new Content(data, "text/html", data.available());
    Why don't you just pass the FileInputStream into the Content object's constructor???
    Best regards, Julian

  • How do i upload an image to a server and put the name into a database table

    Ok, i found a php image upload script that im using for a cms
    image gallery on my site. But for it to work the way i need to i
    have to have certain information submited into a mysql table at the
    same time. I could just make it so the user types the name of the
    image in a second form, but i would rather not have to as it seems
    a clumsy way to do things and opens things up to typos etc.
    So, i can upload the image ok, and i can upload data to the
    table, but i dont know what I have to do so that the name of the
    uploaded file is automaticly inserted into the mysql table.
    The first bit of code below is the form I am using to upload
    the file to the server. The second bit of code is what I am using
    to tell the server what the file name is.
    How do I combine the 2 form into one? Please help. It is
    driving me to dispair.
    Attach Code
    <form enctype="multipart/form-data" action="uploader.php"
    method="POST">
    <input type="hidden" name="MAX_FILE_SIZE" value="500000"
    />
    Choose a file to upload: <input name="uploadedfile"
    type="file" />
    <br />
    <input type="submit" value="Upload File" />
    </form>
    <form action="<?php echo $editFormAction; ?>"
    method="post" name="form2" id="form2">
    <table align="center">
    <tr valign="baseline">
    <td nowrap="nowrap" align="right">Image One</td>
    <td><input type="text" name="kingsImage1"
    value="<?php echo
    htmlentities($row_rskingscentre['kingsImage1'], ENT_COMPAT,
    'UTF-8'); ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
    <td nowrap="nowrap" align="right">Image Two</td>
    <td><input type="text" name="kingsImage2"
    value="<?php echo
    htmlentities($row_rskingscentre['kingsImage2'], ENT_COMPAT,
    'UTF-8'); ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
    <td nowrap="nowrap" align="right">Image
    Three</td>
    <td><input type="text" name="kingsImage3"
    value="<?php echo
    htmlentities($row_rskingscentre['kingsImage3'], ENT_COMPAT,
    'UTF-8'); ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
    <td nowrap="nowrap"
    align="right"> </td>
    <td><input type="submit" value="Update record"
    /></td>
    </tr>
    </table>
    <p>  </p>
    <p>
    <input type="hidden" name="MM_update" value="form2" />
    <input type="hidden" name="kingsHeader" value="<?php
    echo $row_rskingscentre['kingsHeader']; ?>" />
    </p>
    </form>

    jeffoirecoupe1234 wrote:
    > Ok, i found a php image upload script that im using for
    a cms image gallery on
    > my site. But for it to work the way i need to i have to
    have certain
    > information submited into a mysql table at the same
    time. I could just make it
    > so the user types the name of the image in a second
    form, but i would rather
    > not have to as it seems a clumsy way to do things and
    opens things up to typos
    > etc.
    >
    > So, i can upload the image ok, and i can upload data to
    the table, but i dont
    > know what I have to do so that the name of the uploaded
    file is automaticly
    > inserted into the mysql table.
    >
    > The first bit of code below is the form I am using to
    upload the file to the
    > server. The second bit of code is what I am using to
    tell the server what the
    > file name is.
    >
    > How do I combine the 2 form into one? Please help. It is
    driving me to dispair.
    >
    > Attach Code
    >
    > <form enctype="multipart/form-data"
    action="uploader.php" method="POST">
    > <input type="hidden" name="MAX_FILE_SIZE"
    value="500000" />
    > Choose a file to upload: <input name="uploadedfile"
    type="file" />
    > <br />
    > <input type="submit" value="Upload File" />
    > </form>
    >
    > <form action="<?php echo $editFormAction; ?>"
    method="post" name="form2"
    > id="form2">
    > <table align="center">
    > <tr valign="baseline">
    > <td nowrap="nowrap" align="right">Image
    One</td>
    > <td><input type="text" name="kingsImage1"
    value="<?php echo
    > htmlentities($row_rskingscentre['kingsImage1'],
    ENT_COMPAT, 'UTF-8'); ?>"
    > size="32" /></td>
    > </tr>
    > <tr valign="baseline">
    > <td nowrap="nowrap" align="right">Image
    Two</td>
    > <td><input type="text" name="kingsImage2"
    value="<?php echo
    > htmlentities($row_rskingscentre['kingsImage2'],
    ENT_COMPAT, 'UTF-8'); ?>"
    > size="32" /></td>
    > </tr>
    > <tr valign="baseline">
    > <td nowrap="nowrap" align="right">Image
    Three</td>
    > <td><input type="text" name="kingsImage3"
    value="<?php echo
    > htmlentities($row_rskingscentre['kingsImage3'],
    ENT_COMPAT, 'UTF-8'); ?>"
    > size="32" /></td>
    > </tr>
    > <tr valign="baseline">
    > <td nowrap="nowrap"
    align="right"> </td>
    > <td><input type="submit" value="Update record"
    /></td>
    > </tr>
    > </table>
    > <p>  </p>
    > <p>
    > <input type="hidden" name="MM_update" value="form2"
    />
    > <input type="hidden" name="kingsHeader"
    value="<?php echo
    > $row_rskingscentre['kingsHeader']; ?>" />
    > </p>
    > </form>
    >
    >
    >
    Hi Jeff:
    Though this does not show you how to solve this issue via a
    code
    snippett, there are a couple of extensions at WebAssist.com
    that enable
    you to do this, they are Data Assist and Digital File Pro.
    When you have
    time, take a look at these Solution Recipes (tutorials) that
    show how
    DataAssist is used and then now Digital File Pro is used in
    conjunction
    with DataAssist:
    http://www.webassist.com/professional/products/solutionrecipe/Media_139.asp
    http://www.webassist.com/professional/products/solutionrecipe/Media_112.asp
    DataAssist can be used to save time when you need to build
    database
    search and management applications quickly, and Digital File
    Pro can be
    used to include file upload functionality to your form fields
    while
    enabling you to insert your server file name into the
    database, all on
    the same page.
    enthusiastically,
    mark haynes

  • How to upload a image or flash file as blob object in a table.

    How to upload a image or flash file as blob object in a table.
    What are all the possible ways we can do it.

    Searching the forum (or google) would be my first choice, as this question pops up every now and then.
    Next without knowledge of your environment (jdev version and technology stack) it's hard to give a profound answer.
    All I can say is that it's possible.
    Timo

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

  • Uploading Safari images into 'Blackboard' doesn't work.

    I am using an iMac G5, OS X (10.4.8), 2Ghz PowerPC with 512 MG of RAM.
    I am able to successfully create .html files with various programs (Nvu, Dreamweaver, Mozilla,) and I can open those documents and see the images in them in my default Safari browser (as well Explorer, Firefox, Mozilla,). I USED to able to upload those documents successfully into the 'Blackboard' program my college uses. Here I can't be helpful: I did something -perhaps changed my browser from Netscape Navigator to Safari, but I can't guarantee that's the problem- so that the uploads show the text but no longer load the images. When I open the documents in the Blackboard program, the images don't show as broken, they show as question marks in a small blue square in the center of the missing image.
    I have tried the Blackboard help site, and all the image-loading recommendations I see on this forum. I've tried going to 'Safari> Preferences> Appearance> Display images when the page opens' and making sure that box is checked. I've tried finding 'Safari> File> Publish as> and making sure images are published, but I can't find that option on my Mac. None of the tech support at school can solve the problem -though the process supposedly works just fine on a PC. I have struggled with this for months, and since I teach art history and need to show images, it is making my life miserable. Any help would be much appreciated.
    Carolyn
    iMac G5   Mac OS X (10.4.8)   PowerMac8,2

    Thanks for the rapid response! A pity I don't have the language to be of more help.
    First, 'Blackboard.edu' is a service institutions of education subscribe to. Faculty users publish their class webpages, and can keep those inhouse or make them available to the www. So, I've been publishing web pages (in house) for my classes for years. This year I've run into problems with getting my .html documents to load the images contained in them. I do believe my colleagues have uploaded my documents successfully onto their Blackboards via PCs, leading me to believe this is a Mac problem . . .
    Someone suggested this was a browser problem, so I kept trying different default browsers, searching their preferences for any boxes that needed to be checked to allow images. Each time I upload I am told the upload was sucessful -I get no error messages- and each time the images don't load.
    I defaulted to Safari and did as you suggested, and there was a slight change. Instead of the blue-box question mark, the image title was displayed, but still no image.
    iMac G5   Mac OS X (10.4.8)   PowerMac8,2. / 2 GHz PowerPC

  • Need to Upload the image into XMII server from a desktop

    Hi,
    Can anyone let me know how to upload the image from my laptop on to the server which i should be using in my pages. I tried using Image Loader and Image Saver. But it lead me no where. Is there a detailed documentation for this ?
    Thanks for your help in Advance.
    Regards,
    Deepthi lakshmi.A.

    Hi Deepti,
    Could you give some details on what you are trying to achieve.
    Is this a use case scenario where images need to be uploaded by a handful of people using some web UI?
    or
    Is this a use case scenario where you wish to upload images from the harddrive of absolutely any user?
    The reason for my questions is as follows.
    If you wish to allow some high-level (technically savvy) users the ability to upload images to be shown in dynamic content for remainder of the public, you could, in theory, set up a network directory that xMII is able to see.  These High-Level users could drop their images in the folder and specify the path in a text box.
    You could go one step further and use Get Folder List action from within an Xacute transaction and display the list of images in this folder on a web UI.  Users could pick the image from the list and "Bob's your Uncle!".
    Hope this helps,
    Cheers,
    Jai.

  • Pull images from SQL/PHP into Flash

    I have a website that displays images that are stored in a
    SQL database using PHP as a method for pulling and displaying the
    images. These images are stored in the database as text (ex:
    image1), then the PHP looks for the image like this:
    <img src="images/Photograph/<?php echo
    $row_rs_Photos['Image']; ?>.jpg" alt="" width="<?php echo
    $row_rs_Photos['Thumb_Width']; ?>" height="<?php echo
    $row_rs_Photos['Thumb_Height']; ?>" border="0" title="" />
    I want to pull these images into Flash. I've done a bunch of
    ActionScripting, but am no expert. Really don't have the foggiest
    idea where to start.
    -kirk

    I seem to have this one working, kinda. It has an array and
    automatically numbers the buttons, but there are some buttons, that
    ask SQL to return a photo that doesn't exist. For instance, there
    is no 7 or 8 ID in my SQL, so those buttons don't work:
    http://www.lbiphotos.com/Flash/loadImages_finished.html
    PHP Code:
    <?php require_once('my.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType,
    $theDefinedValue = "", $theNotDefinedValue = "")
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue)
    : $theValue;
    $theValue = function_exists("mysql_real_escape_string") ?
    mysql_real_escape_string($theValue) :
    mysql_escape_string($theValue);
    switch ($theType) {
    case "text":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" :
    "NULL";
    break;
    case "long":
    case "int":
    $theValue = ($theValue != "") ? intval($theValue) : "NULL";
    break;
    case "double":
    $theValue = ($theValue != "") ? "'" . doubleval($theValue) .
    "'" : "NULL";
    break;
    case "date":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" :
    "NULL";
    break;
    case "defined":
    $theValue = ($theValue != "") ? $theDefinedValue :
    $theNotDefinedValue;
    break;
    return $theValue;
    $colname_rs_Photos = "-1";
    if (isset($_GET['passID'])) {
    $colname_rs_Photos = (get_magic_quotes_gpc()) ?
    $_GET['passID'] : addslashes($_GET['passID']);
    mysql_select_db($database_LBI_Photos_Connection,
    $LBI_Photos_Connection);
    $query_rs_Photos = sprintf("SELECT ID_Photos, Image,
    YearPhotographed FROM Photos WHERE ID_Photos = %s",
    GetSQLValueString($colname_rs_Photos, "int"));
    $rs_Photos = mysql_query($query_rs_Photos,
    $LBI_Photos_Connection) or die(mysql_error());
    $row_rs_Photos = mysql_fetch_assoc($rs_Photos);
    $totalRows_rs_Photos = mysql_num_rows($rs_Photos);
    $imageId = $_GET['passID'];
    //MUST use code below to grab $images
    $images =
    $row_rs_Photos['YearPhotographed'].'/'.$row_rs_Photos['Image'];
    print "image=" . $images;
    ?>
    <?php
    mysql_free_result($rs_Photos);
    ?>
    ACTIONSCRIPT:
    function loadImage(passID:Number) {
    var resultLv:LoadVars = new LoadVars();
    var sendLv:LoadVars = new LoadVars();
    resultLv.onLoad = function(success) {
    if (success) {
    mcLoader.loadClip(imagePath+this.image+".jpg",
    loadContainer);
    trace("passID: "+passID);
    sendLv.sendAndLoad(phpPath+"?passID="+String(passID),
    resultLv);
    function loadInit(target:MovieClip) {
    trace("Begin Loading File");
    trace("imagePath + this.image ; "+imagePath+this.image);
    function assignButtons() {
    for (var i in loadButtons) {
    this[loadButtons
    ].numberTxt.text = String(Number(i)+1);
    this[loadButtons].onRollOver = function() {
    this.gotoAndStop(2);
    this[loadButtons
    ].onRollOut = function() {
    this.gotoAndStop(1);
    this[loadButtons].onRelease = function() {
    trace("String(this).length "+String(this).length);
    if (String(this).length == 16) {
    loadImage(Number(String(this).substring(String(this).length-1)));
    if (String(this).length == 17) {
    loadImage(Number(String(this).substring(String(this).length-2)));
    var loadButtons:Array = new Array('loadBtn1', 'loadBtn2',
    'loadBtn3', 'loadBtn4', 'loadBtn5', 'loadBtn6', 'loadBtn7',
    'loadBtn8', 'loadBtn9', 'loadBtn10', 'loadBtn11', 'loadBtn12',
    'loadBtn13', 'loadBtn14', 'loadBtn15', 'loadBtn16');
    var loadContainer:MovieClip =
    this.createEmptyMovieClip("loadContainer",
    this.getNextHighestDepth());
    var siteUrl:String = "
    http://www.lbiphotos.com";
    var imagePath:String = siteUrl+"/images/Photograph/";
    var phpPath:String = siteUrl+"/Flash/images.php";
    var mcLoader:MovieClipLoader = new MovieClipLoader();
    var mcLoadObj:Object = new Object();
    mcLoadObj.onLoadInit = loadInit;
    mcLoader.addListener(mcLoadObj);
    //below centers called image
    loadContainer._x = (Stage.width/2-100);
    loadContainer._y = (Stage.height/2-100);
    assignButtons();

  • Importing images into Flash

    I am importing images into Flash only to discover that the images (1280 x 720) are not centered on the stage.  Most of the time the images are off centre by a few pixel widths or in some cases by an inch or more.   I can't get them to centre unless I clear the stage and import a few times.
    Is there a way to import and have the images framed perfectly within the stage.
    I'm currently using Flash CS5.5
    Thank you.

    You can also click the two blue boxes icon under the Timeline and then drag select the whole timeline and that will let you select all your frames at once. then just position them all where you want them at the same time. I attached a screen cap of the area I'm talking about. It's right after the two white boxes.

  • Need to know how to disconnect the camera Nikon Ds3 (USB cable) properly after uploading images through bridge-do not want to lose images on compact flash card.

    Need to know how to disconnect the camera Nikon Ds3 (USB cable) properly after uploading images through bridge…do not want to lose images on compact flash card.

    Give #navbar a width that is wide enough to hold all of the buttons within it.
    #navbar {
         width:####px;
    Replace #### with a pixel number large enough to hold the nav buttons.

Maybe you are looking for

  • How to  upload data from flat file to datastore object in BI 7.0

    Dear friends, Please tell me step by step process for upload data from flat file to datastore object in BI 7.0 <removed by moderator> please help me Thanks, D.prabhu Edited by: Siegfried Szameitat on Aug 17, 2011 11:40 AM

  • Web graphic links work on Mac, but not PC

    I have two websites. The old one is DogToysAndTreats.com. The new one is FunStuffForDogs.com. I need to change the home page graphic on both of them to point to my shopping cart pages. I have done this and published the changes on both sites. It work

  • BPM message collect problem

    Hi, I have a problem with  collecting messages and sending them together. I'm trying to work out a simple correlation example. Its a File -> XI -> File scenario. I followed the blog /people/pooja.pandey/blog/2005/07/27/idocs-multiple-types-collection

  • Zen Micro Random Algorithm. What is

    I think the biggest thing with this mp3 player you need is patience. I think everyone's had something go wrong, and few have had it work flawlessly on the first time. That said; What is the deal with the DJ- Random Play all function. My micro seems t

  • Vendor master deletion question..

    I need confirmation about something. In order to delete vendor master data from the system, even though the vendor has never been used, has no transactinal data and has been blocked and marked for deletion... does it still have to be archived with th