2013년 6월 30일 일요일

ubuntu sshfs usage

My Ubuntu version is 13.04 64bit

1.install package

#apt-get install sshfs


2.usage

#mkdir ~/workspace/remotedir
#sshfs remote-account@remote.server.com:/remote/directory ~/workspace/remotedir

3.unmount

#fusermount -u  ~/workspace/remotedir



file upload dynamic add delete from form

i need file upload form html.
I've been used only one file upload in a form or static muliple input type files in a form.
I need dynamic multiple file upload from a form.

I. Get a Sample
II.Run a Sample Code
III. Make It Your Own.
IV. Make It Shippable.


I. Get a Sample
 
I use readmine. The file upload routine is first view one file upload input field,
second press "order file add" button then file upload input is appear. this is what I want.
 
i can understand upload source. but i have to guess that how server works. 
 
here is redmine source code javascript.
======================================================================
application.js
======================================================================
var fileFieldCount = 1;

function addFileField() {
  var fields = $('attachments_fields');
  if (fields.childElements().length >= 10) return false;
  fileFieldCount++;
  var s = new Element('span');
  s.update(fields.down('span').innerHTML);
  s.down('input.file').name = "attachments[" + fileFieldCount + "][file]";
  s.down('input.description').name = "attachments[" + fileFieldCount + "][description]";
  fields.appendChild(s);
}

function removeFileField(el) {
  var fields = $('attachments_fields');
 var s = Element.up(el, 'span');
 if (fields.childElements().length > 1) {
  s.remove();
 } else {
  s.update(s.innerHTML);
 }
}

function checkFileSize(el, maxSize, message) {
  var files = el.files;
  if (files) {
    for (var i=0; i<files.length; i++) {
      if (files[i].size > maxSize) {
        alert(message);
        el.value = "";
      }
    }
  }
}
========================================================================= 

Now it's enough make a sample upload form.
======================================================================
uploadForm.html
======================================================================


======================================================================
uploadProc.php
=========================================================================
<?
print_r($_FILES);
?>
 


ssh port forwarding to MySQL server in linux machine


 ssh port forwarding to MySQL server in linux machine

#ssh -L 3306:localhost:3306 account@domain.com

#mysql -uroot -p 127.0.0.1